Click here to Skip to main content
15,301,401 members
Please Sign up or sign in to vote.
0.00/5 (No votes)
See more:
hai sir

in my page i have checkboxlist and one button .
i was bind data to checkboxlist through sqldatabase ,
then i was checked some checkboxlist items and click on button
after click on button that checkboxlist checked items are unckecked.
thats my problem.

when click on button also i want maintain checked items are with cheked.

my design is:
<asp:CheckBoxList ID="chkNoDue" runat="server" Checked="True" EnableViewState="true"  DataTextField="mi_DOC_NAME" DataValueField="MI_DOCUMENTSLIST_ID" AppendDataBoundItems="false" >

<asp:Button id="btnDocuments" runat="server" OnClick="btnDocuments_Click">

my code is:

in page load i was bind data to checkboxlist.

in button click
for (int i = 0; i < chkNoDue.Items.Count; i++)

              int Documentid  = Convert.ToInt32(chkNoDue.Items[i].Value.ToString());
              Boolean check;
       if (chkNoDue.Items[i].Selected)
           check = true;
           check = false;

help me !!
Updated 20-Nov-14 20:27pm

1 solution

In Page Load bind the checkboxlist inside the 'Is Not Postback'.

protected void Page_Load(object sender, EventArgs e)
   if (!IsPostBack)
        //Bind Checkboxlist here

Hope it will solve your issue. Thanks
Member 10776340 21-Nov-14 3:19am
still i have same problem..
Vishal_Kumar 21-Nov-14 4:15am
Could you please attach your server side code here.

This content, along with any associated source code and files, is licensed under The Code Project Open License (CPOL)

CodeProject, 20 Bay Street, 11th Floor Toronto, Ontario, Canada M5J 2N8 +1 (416) 849-8900