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..
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());
}
}