Zakir Ahamed

Zakir Ahamed

  • NA
  • 1.4k
  • 625.9k

i have a problem in chekedListBox to bind a data

Aug 7 2017 3:37 AM
hi friends ,
 
i have a problem Checkedlist box To bind a data what i have saved in grid..
i want to bind the data i was saved for updATION CHANGES..
 
my code:
private void GvCategory_CellDoubleClick(object sender, DataGridViewCellEventArgs e)
{
try
{
indexRow = e.RowIndex;
DataGridViewRow row = GvCategory.Rows[indexRow];
txtcategory.Text = row.Cells[1].Value.ToString();
//txtcategory.ReadOnly = true;
btncategory.Text = "Update";
rbyes.Checked = true;
if (txtcategory.Text != " ")
{
try
{
Hashtable hash = new Hashtable();
hash.Add("@status","Brand");
hash.Add("@categoryname",txtcategory.Text);
DataTable dtLoad = DataAccessLayer.GetDataTable("Category_Mst_sp", hash);
string[] s = new string[] {};
if (dtLoad != null && dtLoad.Rows.Count > 0)
{
for (int i = 0; i < dtLoad.Rows.Count; i++)
{
s = dtLoad.Rows[i]["BrandId"].ToString().Split(',');
}
for (int i = 0; i < clbbrand.Items.Count; i++)
{
/*Now with the following code we can get valemember and displaymember as per your requirement you can store in table. */
DataRow r;
r = ((DataRowView)this.clbbrand.CheckedItems[i]).Row;
string val = (r[this.clbbrand.ValueMember]).ToString();
string dis = (r[this.clbbrand.DisplayMember]).ToString();
r = null;
}
}
catch (Exception ex)
{
MessageBox.Show(ex.Message.ToString());
}
}
}
catch (Exception ex)
{
MessageBox.Show(ex.Message.ToString());
}
}
 
if any one help to get data bind in checkedlistbox:
 
 

Answers (2)