Click here to Skip to main content
15,949,741 members
Please Sign up or sign in to vote.
0.00/5 (No votes)
See more:
I have created a check box.when I check this checkbox I want this to get saved.Can some one suggest me some ideas
XML
<td>
                                                                     <asp:CheckBoxList ID="CheckBoxList1" runat="server" Width="227px" Style="margin-left: 0px">
                                                                         <asp:ListItem>xx</asp:ListItem>
                                                                         <asp:ListItem>yy</asp:ListItem>
                                                                         <asp:ListItem>zz</asp:ListItem>
                                                                         
                                                                     </asp:CheckBoxList>
                                                                     &nbsp;
                                                                 </td>
Posted

hi
C#
foreach (ListItem li in CheckBoxList1.Items)
       {
           if (li.Selected == true)
           {
               //your code is here
               Response.Write("<script>alert('"+li.Text +"')</script>");
           }
       }
 
Share this answer
 
hello

C#
foreach(ListItem li in CheckBoxList1.Items)
        {
            if(li.Selected == true)
            {
               //Write here your code for saving 
            }
        }
 
Share this answer
 
v2

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