I have a panel that is being populated in my asp.net application. I need to capture the selected values (I.E. the check boxes that have been captured). This is my syntax which appears to be syntatically correct, but it is not capturing the checked checkboxes. What did I set-up incorrect?
[code]
Select Active Students
OnClick="buttonClearCheckedBoxes_Click" />
protected void Page_Load(object sender, EventArgs e)
{
if (!IsPostBack)
{
PopulateAllStudents();
}
}
private void PopulateAllStudents()
{
this.chkBoxes.DataSource =
this.chkBoxes.DataTextField = "StudentFullName";
this.chkBoxes.DataValueField = "StudentID";
this.chkBoxes.DataBind();
}
protected void btnClickIT_click(object sender, EventArgs e)
{
try
{
foreach (ListItem item in this.chkBoxes.Items)
{
if (item.Selected)
{
//Do Stuff Here
}
}
}
catch
{
}
}
[/code]
Replies
Know the answer? Post it — somebody with the same question will find it here.