Im trying to bind my data into gridview only when at least one checkbox is checked in each checkboxlist. However it does not seem to work as when I click on submit it with no checkbox checked it still go in the bind statement and did not display the text message in the label.
Where did it gone wrong in my code? please help
if (IsPostBack)
{
if (CheckBoxList1.SelectedValue != null && CheckBoxList2.SelectedValue != null)
{
Bind();
}
else if (CheckBoxList1.SelectedValue == String.Empty)
{
LABEL1.Text = ("Please select at least one checkbox();
}
else if (CheckBoxList2.SelectedValue == String.Empty)
{
LABEL2.Text = ("Please select at least one checkbox").ToString();
}