Multiple checkbox list
I have a multiple list of checkboxes where when I select values, the data should be displayed in a grid. my problem is here when ever i select multiple data, only the data of the first name in the list is displayed please help me
this is the code i am using
protected void CheckBoxList1_SelectedIndexChanged(object sender, EventArgs e)
{
txtSelect.Text = "";
for (int c = 0; c < CheckBoxList1.Items.Count; c++)
{
if (CheckBoxList1.Items[c].Selected)
{
txtSelect.Text += CheckBoxList1.Items[c].Text + ";" + "" + "";
}
}
}
This is how I bind data
"SelectCommand =" sp_LeMS_DDL_Report "SelectCommandType =" StoredProcedure ">
source to share
One possible way is to make sure you have
AutoPostBack = true
in your CheckBoxList so that your web page can reload all data after changes. Then every time you change the selection, the code that should be under
if(isPostBack)
will work. Then you can add the selected values ββto your insert or update statements for your gridview datasource.
source to share