How to extract data from Dynamic Checkboxes?
Hi
I am trying to build an application where checkboxes are getting generated based on data from back-end like:
private void Button2_Click(object sender, System.EventArgs e)
{
.................
chkList1 = new CheckBoxList();
chkList1.ID = "MachineList";
...............................................
.................................................. ..
sdr1 = dbc3.execQuerry("SELECT ...................");
while(sdr1.Read())
{
location = sdr1[0].ToString();
// populate the check box list
ListItem listItem = new ListItem();
listItem.Value = location1;
listItem.Text = location;
chkList1.Items.Add(listItem);
}
}
//adding the chkList to Panel
Panel1.Controls.Add(chkList1);
But now I have a button "Use" which takes the checked values from these dynamic CheckBoxList s. But my question is how to extract the values?
Whenever I click on "use" the page reloads, erasing the checkboxes and hence my chances to retrive any "clicked" chekboxes from them!
Any help will be greatly appreciated.
leothelion123
|