CkeckBoxList value insert to database.

Dec 30 2014 9:16 AM
i am working on a project that will allow me submit multiple selected value from checklistBox control to sql 2008 database.

i want users to fill the textBox,pick values from the dropdown and check boxes.... after hitting the button... it shoud submit into the database.

Thanks in advance

see below the html structure:

<div>
 
  <table class="style1">
  <tr>
  <td class="style3">
  PolicyNumber</td>
  <td class="style2">
  <asp:TextBox ID="TextBox1" runat="server"></asp:TextBox>
  </td>
  </tr>
  <tr>
  <td class="style3">
  Business</td>
  <td class="style2">
  <asp:DropDownList ID="DropDownList1" runat="server" AutoPostBack="True"
  onselectedindexchanged="DropDownList1_SelectedIndexChanged">
  <asp:ListItem>Select Item</asp:ListItem>
  <asp:ListItem>Private</asp:ListItem>
  <asp:ListItem>Commercial</asp:ListItem>
  </asp:DropDownList>
  </td>
  </tr>
  <tr>
  <td class="style3">
  Type</td>
  <td class="style2">
  <asp:DropDownList ID="DropDownList2" runat="server" Visible="False">
  </asp:DropDownList>
  </td>
  </tr>
  <tr>
  <td class="style3" bgcolor="White">
  Product</td>
  <td class="style2">
  &nbsp;</td>
  </tr>
  <tr>
  <td class="style3" bgcolor="White">
  &nbsp;</td>
  <td class="style2">
  <asp:CheckBoxList ID="CheckBoxList1" runat="server"
  DataSourceID="SqlDataSource1" DataTextField="Product" DataValueField="Product"
  RepeatColumns="2" RepeatDirection="Horizontal" Width="450px">
  </asp:CheckBoxList>
  <asp:SqlDataSource ID="SqlDataSource1" runat="server"
  ConnectionString="<%$ ConnectionStrings:MotorConnectionString %>"
  SelectCommand="SELECT * FROM [Product]"></asp:SqlDataSource>
  </td>
  </tr>
  <tr>
  <td class="style3">
  &nbsp;</td>
  <td class="style2">
  <asp:Button ID="Button1" runat="server" Text="Submit" Font-Bold="True"
  Font-Size="Large" Height="45px" Width="150px" />
  </td>
  </tr>
  </table>
 
  </div>

Answers (1)