public void savetoDB() { con1.Open(); string qry = null; string inputvalue = null; int i = 0; for (i = 0; i <= CheckBoxList2.Items.Count - 1; i++) { if (CheckBoxList2.Items[i].Selected == true) { inputvalue = CheckBoxList2.Items[i].Text; qry = "INSERT INTO DART_IDC_ADD_PROC_MAP(DAR_ID,ADD_PROC_SEL) VALUES (123,'" + inputvalue + "')"; SqlCommand cmd = new SqlCommand(qry, con1); cmd.ExecuteNonQuery(); } } con1.Close(); }
<asp:ScriptManager ID="ScriptManager1" runat="server"> </asp:ScriptManager> <asp:UpdatePanel ID="UpdatePanel1" runat="server"> <ContentTemplate> <asp:CheckBoxList ID="CheckBoxList2" runat="server" AppendDataBoundItems="True" EnableViewState="False"> </asp:CheckBoxList> </ContentTemplate> </asp:UpdatePanel> <br /> <asp:Button ID="Button1" runat="server" onclick="Button1_Click" Text="Button" /> <br />
var
This content, along with any associated source code and files, is licensed under The Code Project Open License (CPOL)