- bind an event to a button,
- iterate through the
Items property CheckBoxList - set the text value according to the
selected listitem property
as:
protected void button_Click(object sender, EventArgs e) { foreach (ListItem item in theCheckBoxList.Items) { item.Text = item.Selected ? "Checked" : "UnChecked"; } }
to add a value you could do:
foreach (ListItem item in theCheckBoxList.Items) { item.Text = item.Selected ? item.Value : ""; }
or display al values ββin the mini-report:
string test = "you've selected :"; foreach (ListItem item in theCheckBoxList.Items) { test += item.Selected ? item.Value + ", " : ""; } labelResult.Text = test;
source share