<div>
<asp:CheckBoxList ID="CheckBoxList1" runat="server" AutoPostBack="true"
onselectedindexchanged="CheckBoxList1_SelectedIndexChanged"
>
</asp:CheckBoxList>
<br />
<br />
<asp:Label ID="lblChkSelItems" runat="server"></asp:Label>
</div>
This is my code behind page:-
protected void CheckBoxList1_SelectedIndexChanged(object sender, EventArgs e)
{
int i=0;
string msg = "You have selected the following items: ";
if (CheckBoxList1.Items[i].Selected)
{
msg = msg + CheckBoxList1.Items[i].Text + "<br>";
}
lblChkSelItems.Text = msg;
}
Even after enabling autopostback option as true,i cant get my required result.. Help me out guyz!!!!
Chris Anderson
15-Nov-2011You can use the code give below: