I created 2 websites form;
- Checkboxcount.aspx
- Display.aspx
If there are to or less checked checkbox, then the items will appear at display page. If the checked checkbox are more than 2, the items will be null. I've try this code but no output appear.
Checkboxcount.aspx
protected void Button1_Click(object sender, EventArgs e)
{
string CheckedSubSuggestion = "";
int checkedcheckbox = CheckBoxList1.Items.Count;
if (checkedcheckbox < 3)
{
for (int i = 0; i < checkedcheckbox; i++)
{
if (CheckBoxList1.Items[i].Selected)
{
CheckedSubSuggestion += "Subject Suggestion : " + "<h1>" + CheckBoxList1.Items[i].Text + "</h1><br/>";
}
else
{
CheckedSubSuggestion = "";
}
}
}
}
Display.aspx
protected void Page_Load(object sender, EventArgs e)
{
checkboxcount.Text = "Subject Suggestion : " + Session["SubSuggestion"].ToString();
}
Please help me to solve this problem as i try to solve it for almost a couple weeks.