Zakir Ahamed

Zakir Ahamed

  • NA
  • 1.4k
  • 627.8k

i have loop problem

Aug 30 2017 3:05 AM
hi this is my code i have selected values prblem:
 
else if (btncategory.Text == "Update")
{
string ChkSelectedValue = string.Empty;
//object chBoxListTables = null;
for (int i = 0; i < clbbrand.Items.Count; i++)
{
if (clbbrand.Items[i].Selected)  -->> prblm Selected**
{
ChkSelectedValue = clbbrand.Items[i].Value + ',';  -->> Value** Passing Prblm
}
}
//int Items = 0;
//for (int i = 0; i < clbbrand.Items.Count; i++)
//{
// if (clbbrand.Items[i].Selected)
// //if(clbbrand.SelectedIndex > 0)
// {
// ChkSelectedValue = chBoxListTables.Items[i].Value+ ',';
// }
//}
Hashtable hstbl = new Hashtable();
DataGridViewRow row = GvCategory.Rows[indexRow];
hstbl.Add("@status", "update");
hstbl.Add("@CategoryId", Convert.ToInt32(row.Cells[0].Value));
hstbl.Add("@updatedby", Global.UserID);
hstbl.Add("@BrandId",ChkSelectedValue);
Int64 dt = DataAccessLayer.ExecuteCommand_RowsAffected("Category_Mst_sp", hstbl);
if (dt >= 0)
{
MessageBox.Show("Category Details Updated Sucessfully", "Category Alert");
txtcategory.Text = string.Empty;
LoadCategory();
btncategory.Text = "SAVE";
}
else
{
MessageBox.Show("Already Entered the Category");
}
}
}
else
{
string title = "Category";
MessageBox.Show("Please Enter the Category", title);
}
}
catch (Exception exceptionObj)
{
MessageBox.Show(exceptionObj.Message.ToString());
}
}
 

Answers (8)