How to fire an event based on selected item in Checkboxlist (ASP.net 3.5), the OnSelectedIndexChanged in Checkboxlist returns a list of all the selected items, where I need to know just the current selected item.
0
votes
1 Answers
0
votes
Why wouldn't a checkbox list return all of the checkboxes selected? The nature of a checkbox list is that multiple can be selected at the same time.
If you desired only a single item, perhaps a radioButtonList or DropDownList would be more appropriate?
http://msdn.microsoft.com/en-us/library/1wd7hsyy(v=VS.85).aspx
Protected void DropDownList1_SelectedIndexChanged(object sender,
System.EventArgs e)
{
Label1.Text = "You selected " + DropDownList1.SelectedItem.Text;
}
Feel free to test CheckBoxList.SelectedItem, but the wording does not clearly indicate that it has the same functionality as RadioButtonList or DropDownList.
http://msdn.microsoft.com/en-us/library/system.web.ui.webcontrols.listcontrol.selecteditem.aspx