title: How to generate checkbox for every field in database using GridView
body: <p>I have limited knowledge on VB coding. I am now creating a system which allow customer to select exhibition event and booth number they want and next reserved which day they want to rent. </p>
  
  <p>By default, in GridView control can add checkbox Field but it only generate 1 checkbox for 1 row of data.</p>
  
  <p>As state in the title, I have no idea how to generate the checkboxes for every field in database call D1,D2,D3,D4,D5,D6 and D7, each carry value 0 by default. 
  Now I want every single field have a checkbox to allow customer select which day they want to reserve and retrieve their checked value to stole into corresponding D1-D7 field, checked value will update value 0 to 1.</p>
  
  <p>Next, how should I coding to store the checked value into database? in default.aspx or default.aspx.vb?</p>
  
  <p>Or any other suggestion to generate checkbox instead of using gridview? </p>
  
  <p>The default view using GridView</p>
  
  <p><img src="https://i.stack.imgur.com/eeMtk.jpg" alt="enter image description here"></p>
  
  <p>What I want</p>
  
  <p><img src="https://i.stack.imgur.com/8pbmc.jpg" alt="enter image description here"></p>
  
  <p>My coding:</p>
  
  <pre><code>    &lt;%@ Page Language="VB" MasterPageFile="~/MasterPageMember.master" AutoEventWireup="false" CodeFile="member_view_event_list.aspx.vb" Inherits="member_view_event_list" title="Untitled Page" %&gt;
  
  &lt;asp:Content ID="Content1" ContentPlaceHolderID="head" Runat="Server"&gt;
  
  
  
      &lt;style type="text/css"&gt;
          .style8
          {
              width: 46px;
          }
          .style9
          {
          }
          .style10
          {
              width: 86px;
          }
      &lt;/style&gt;
  
  
  
      &lt;/asp:Content&gt;
  
  &lt;asp:Content ID="ContentPlaceHolder2" runat="server" 
      contentplaceholderid="ContentPlaceHolder2"&gt;
  
  
  
      &lt;table width="80%"&gt;
          &lt;tr&gt;&lt;td class="style10"&gt;&amp;nbsp;&lt;/td&gt;&lt;td class="style8"&gt;&amp;nbsp;&lt;/td&gt;&lt;td&gt;&amp;nbsp;&lt;/td&gt;&lt;/tr&gt;
          &lt;tr&gt;&lt;td class="style10"&gt;
              &lt;asp:Label ID="Label1" runat="server" Text="Select Event:"&gt;&lt;/asp:Label&gt;
          &lt;/td&gt;&lt;td class="style8"&gt;
              &lt;asp:DropDownList ID="ddlEventList" runat="server" 
                  DataSourceID="SqlDataSourceEvent" DataTextField="eventTitle" 
                  DataValueField="eventID" AutoPostBack="True" Width="200"&gt;
  
              &lt;/asp:DropDownList&gt;
              &lt;asp:SqlDataSource ID="SqlDataSourceEvent" runat="server" 
                  ConnectionString="&lt;%$ ConnectionStrings:ConnectionString1 %&gt;" 
                  SelectCommand="SELECT DISTINCT [eventTitle], [eventID] FROM [booth_eventinfo]"&gt;
              &lt;/asp:SqlDataSource&gt;
          &lt;/td&gt;&lt;td&gt;
                  &amp;nbsp;&lt;/td&gt;&lt;/tr&gt;
  
  
          &lt;tr&gt;&lt;td class="style10"&gt;
              &lt;asp:Label ID="Label2" runat="server" Text="Select Booth:"&gt;&lt;/asp:Label&gt;
              &lt;/td&gt;&lt;td class="style8"&gt;
              &lt;asp:DropDownList ID="ddlBoothList" runat="server" 
                  DataSourceID="SqlDataSourceBooth" DataTextField="boothAlias" 
                  DataValueField="boothID" AutoPostBack="True" Width="200"&gt;
  
              &lt;/asp:DropDownList&gt;
              &lt;asp:SqlDataSource ID="SqlDataSourceBooth" runat="server" 
                  ConnectionString="&lt;%$ ConnectionStrings:ConnectionString1 %&gt;" 
                  SelectCommand="SELECT [boothAlias], [boothID] FROM [booth_eventinfo] WHERE ([eventID] = @eventID)"&gt;
                  &lt;SelectParameters&gt;
                      &lt;asp:ControlParameter ControlID="ddlEventList" Name="eventID" 
                          PropertyName="SelectedValue" Type="Int32" /&gt;
                  &lt;/SelectParameters&gt;
              &lt;/asp:SqlDataSource&gt;
              &lt;/td&gt;&lt;td&gt;
                   &lt;/td&gt;&lt;/tr&gt;
  
  
          &lt;tr&gt;&lt;td class="style10"&gt;
              &amp;nbsp;&lt;/td&gt;&lt;td class="style8"&gt;
                  &amp;nbsp;&lt;/td&gt;&lt;td&gt;
                   &amp;nbsp;&lt;/td&gt;&lt;/tr&gt;
  
  
          &lt;tr&gt;&lt;td class="style9" colspan="3"&gt;
  
              &lt;asp:GridView ID="GridViewDay" runat="server" AutoGenerateColumns="False" 
                  CellPadding="4" DataSourceID="SqlDataSourceDay" ForeColor="#333333" 
                  GridLines="None"&gt;
                  &lt;RowStyle BackColor="#FFFBD6" ForeColor="#333333" /&gt;
                  &lt;Columns&gt;
                      &lt;asp:BoundField DataField="D1" HeaderText="Day1" SortExpression="D1" /&gt;
                      &lt;asp:BoundField DataField="D2" HeaderText="Day2" SortExpression="D2" /&gt;
                      &lt;asp:BoundField DataField="D3" HeaderText="Day3" SortExpression="D3" /&gt;
                      &lt;asp:BoundField DataField="D4" HeaderText="Day4" SortExpression="D4" /&gt;
                      &lt;asp:BoundField DataField="D5" HeaderText="Day5" SortExpression="D5" /&gt;
                      &lt;asp:BoundField DataField="D6" HeaderText="Day6" SortExpression="D6" /&gt;
                      &lt;asp:BoundField DataField="D7" HeaderText="Day7" SortExpression="D7" /&gt;
                  &lt;/Columns&gt;
                  &lt;FooterStyle BackColor="#990000" Font-Bold="True" ForeColor="White" /&gt;
                  &lt;PagerStyle BackColor="#FFCC66" ForeColor="#333333" HorizontalAlign="Center" /&gt;
                  &lt;SelectedRowStyle BackColor="#FFCC66" Font-Bold="True" ForeColor="Navy" /&gt;
                  &lt;HeaderStyle BackColor="#990000" Font-Bold="True" ForeColor="White" /&gt;
                  &lt;AlternatingRowStyle BackColor="White" /&gt;
              &lt;/asp:GridView&gt;
              &lt;asp:SqlDataSource ID="SqlDataSourceDay" runat="server" 
                  ConnectionString="&lt;%$ ConnectionStrings:ConnectionString1 %&gt;" 
                  SelectCommand="SELECT [D1], [D7], [D6], [D5], [D4], [D3], [D2] FROM [booth_eventinfo] WHERE ([boothID] = @boothID)"&gt;
                  &lt;SelectParameters&gt;
                      &lt;asp:ControlParameter ControlID="ddlBoothList" Name="boothID" 
                          PropertyName="SelectedValue" Type="Int32" /&gt;
                  &lt;/SelectParameters&gt;
              &lt;/asp:SqlDataSource&gt;
              &lt;/td&gt;&lt;/tr&gt;
  
  
          &lt;tr&gt;&lt;td class="style10"&gt;
              &amp;nbsp;&lt;/td&gt;&lt;td class="style8"&gt;
                  &lt;asp:CheckBox ID="CheckBox1" runat="server" /&gt;
              &lt;/td&gt;&lt;td&gt;
                  &amp;nbsp;&lt;/td&gt;&lt;/tr&gt;
  
  
  &lt;/table&gt;
  
  &lt;/asp:Content&gt;
  </code></pre>