Use the below Query to Get & Set CheckBoxList Selected Item Using ASP.net
In aspx Page create a CheckBoxList Example query given below
Clear CheckBoxList Selection
In aspx Page create a CheckBoxList Example query given below
<asp:CheckBoxList ID="CheckBoxList1" runat="server" RepeatColumns="3">
<asp:ListItem>Mani</asp:ListItem>
<asp:ListItem>Raja</asp:ListItem>
<asp:ListItem>Durai</asp:ListItem>
</asp:CheckBoxList>
Get CheckboxList Selected Item
strCheckedText = "";
foreach (ListItem
LItem in CheckBoxList1.Items)
{
string
stBool = LItem.Selected.ToString();
if (stBool
== "True")
{
if
(strCheckedText == "")
strCheckedText = LItem.Text;
else
strCheckedText = strCheckedText + "|" + LItem.Text;
}
}
CheckBoxList1.ClearSelection();
Set CheckboxList Selected Item
string[] ss = strCheckedText.Split('|');
int iq = 0;
foreach (ListItem LItem in
CheckBoxList1.Items)
{
for (int i = 0; i
< 3; i++)
{
if
(ss.Length != iq)
{
if
(LItem.Text == ss[iq])
{
LItem.Selected = true;
iq++;
}
}
}
}