protected void chkList_SelectedIndexChanged(object sender, EventArgs e)
{
string sNo = "10202";
string sFName = "Thomas";
string sSName = "A";
string sAddress = "India";
List<string> collections = new List<string>();
collections.Add(sNo);
collections.Add(sFName);
collections.Add(sSName);
collections.Add(sAddress);
for (int i = 0; i < chkList.Items.Count; i++)
{
if (chkList.Items[i].Selected)
chkList.Items[i].Value = collections[i];
else
chkList.Items[i].Value = "";
}
}
<asp:CheckBoxList ID="chkList" AutoPostBack="true" runat="server"
onselectedindexchanged="chkList_SelectedIndexChanged">
<asp:ListItem Selected="True">Serial No</asp:ListItem>
<asp:ListItem>First Name</asp:ListItem>
<asp:ListItem>Last Name</asp:ListItem>
<asp:ListItem>Address</asp:ListItem>
</asp:CheckBoxList>