title: Dropdownlist in templatefield - update fails (null value insertion)
body: <p>I have a gridview. In this i have a templatefield with a DropDownList (DDL in EditItemTemplate mode, label in ItemTemplate mode).
  When i hit edit on of of the detailsview's rows i can select any value from the DDL (the DDL is populated from a sqldatasource), but if i try to execute the update, it fails, because it thinks i didn't supply the data...</p>
  
  <p>Here is the exact error (the DB refuse NULL data):</p>
  
  <blockquote>
    <p>Cannot insert the value NULL into column 'status', table
    'gyumolcs.dbo.orders'; column does not allow nulls. UPDATE fails. The
    statement has been terminated.</p>
  </blockquote>
  
  <p>Here is the code for the gridview:</p>
  
  <pre><code>&lt;!-- language: c# --&gt;
  &lt;asp:SqlDataSource ID="orderadminSqlDataSource" runat="server" 
      ConnectionString="&lt;%$ ConnectionStrings:dotnetConnectionString %&gt;" 
      SelectCommand="SELECT orders.ID, aspnet_Users.UserName, orders.quantity AS Quantity, product.name AS Product, status.name AS Status, orders.date AS Date FROM orders INNER JOIN product ON orders.ordertype = product.ID INNER JOIN status ON orders.status = status.ID INNER JOIN aspnet_Users ON orders.userid = aspnet_Users.UserId ORDER BY date" 
      DeleteCommand="DELETE FROM orders WHERE (ID = @ID)" 
      UpdateCommand="UPDATE orders SET status = @status WHERE (ID = @ID)"&gt;
      &lt;DeleteParameters&gt;
          &lt;asp:Parameter Name="ID" /&gt;
      &lt;/DeleteParameters&gt;
      &lt;UpdateParameters&gt;
          &lt;asp:Parameter Name="status" /&gt;
          &lt;asp:Parameter Name="ID" /&gt;
      &lt;/UpdateParameters&gt;
  &lt;/asp:SqlDataSource&gt;&lt;asp:GridView ID="GridView1" runat="server" AutoGenerateColumns="False" 
          DataSourceID="orderadminSqlDataSource" DataKeyNames="ID" Width="608px" 
          AllowPaging="True" AllowSorting="True" PageSize="15"&gt;
          &lt;Columns&gt;
              &lt;asp:CommandField ShowDeleteButton="True" ShowEditButton="True" /&gt;
              &lt;asp:BoundField DataField="ID" HeaderText="ID" 
                  SortExpression="ID" InsertVisible="False" ReadOnly="True" &gt;
              &lt;ItemStyle HorizontalAlign="Right" /&gt;
              &lt;/asp:BoundField&gt;
              &lt;asp:BoundField DataField="UserName" HeaderText="Felhasználónév" 
                  SortExpression="UserName" &gt;
              &lt;HeaderStyle HorizontalAlign="Center" /&gt;
              &lt;ItemStyle HorizontalAlign="Center" /&gt;
              &lt;/asp:BoundField&gt;
              &lt;asp:BoundField DataField="Quantity" HeaderText="Mennyiség (kg)" 
                  SortExpression="Quantity" &gt;
              &lt;HeaderStyle HorizontalAlign="Center" /&gt;
              &lt;ItemStyle HorizontalAlign="Center" /&gt;
              &lt;/asp:BoundField&gt;
              &lt;asp:BoundField DataField="Product" HeaderText="Termék" 
                  SortExpression="Product" &gt;
              &lt;HeaderStyle HorizontalAlign="Center" /&gt;
              &lt;ItemStyle HorizontalAlign="Center" /&gt;
              &lt;/asp:BoundField&gt;
              &lt;asp:TemplateField HeaderText="Rendelés státusz" SortExpression="status"&gt;
                  &lt;EditItemTemplate&gt;
                      &lt;!--&lt;asp:TextBox ID="TextBox1" runat="server" Text='&lt;%# Bind("Status") %&gt;'&gt;&lt;/asp:TextBox&gt;--&gt;
  
                      &lt;asp:DropDownList ID="DropDownList1" runat="server" 
                          DataSourceID="statustypeDDLSqlDataSource" DataTextField="name"
                          DataValueField="ID"&gt;
                      &lt;/asp:DropDownList&gt;
                      &lt;asp:SqlDataSource ID="statustypeDDLSqlDataSource" runat="server" 
                          ConnectionString="&lt;%$ ConnectionStrings:dotnetConnectionString %&gt;" 
                          SelectCommand="SELECT [ID], [name] FROM [status]"&gt;
                      &lt;/asp:SqlDataSource&gt;
  
                  &lt;/EditItemTemplate&gt;
                  &lt;ItemTemplate&gt;
                      &lt;asp:Label ID="status" runat="server" Text='&lt;%# Bind("Status") %&gt;'&gt;&lt;/asp:Label&gt;
                  &lt;/ItemTemplate&gt;
                  &lt;HeaderStyle HorizontalAlign="Center" /&gt;
                  &lt;ItemStyle HorizontalAlign="Center" /&gt;
              &lt;/asp:TemplateField&gt;
              &lt;asp:BoundField DataField="Date" HeaderText="Dátum" SortExpression="Date" /&gt;
          &lt;/Columns&gt;
          &lt;PagerSettings PageButtonCount="15" Mode="NumericFirstLast" /&gt;
      &lt;/asp:GridView&gt;
  </code></pre>
  
  <p>And here is the orderadminSqlDataSource's code (the gridview's datasource)</p>
  
  <pre><code>&lt;!-- language: c# --&gt;
      &lt;asp:SqlDataSource ID="orderadminSqlDataSource" runat="server" 
          ConnectionString="&lt;%$ ConnectionStrings:dotnetConnectionString %&gt;" 
          SelectCommand="SELECT orders.ID, aspnet_Users.UserName, orders.quantity AS Quantity, product.name AS Product, status.name AS Status, orders.date AS Date FROM orders INNER JOIN product ON orders.ordertype = product.ID INNER JOIN status ON orders.status = status.ID INNER JOIN aspnet_Users ON orders.userid = aspnet_Users.UserId ORDER BY date" 
          DeleteCommand="DELETE FROM orders WHERE (ID = @ID)" 
          UpdateCommand="UPDATE orders SET status = @status WHERE (ID = @ID)"&gt;
          &lt;DeleteParameters&gt;
              &lt;asp:Parameter Name="ID" /&gt;
          &lt;/DeleteParameters&gt;
          &lt;UpdateParameters&gt;
              &lt;asp:Parameter Name="status" /&gt;
              &lt;asp:Parameter Name="ID" /&gt;
          &lt;/UpdateParameters&gt;
      &lt;/asp:SqlDataSource&gt;
  </code></pre>
  
  <p>Please help me, i can't figure out the problem.
  Thanks in advance!</p>