title: Validation in table control
body: <p>Currently I'm doing a web form and added some <code>textbox</code> for users to insert into the database. It is working alright already, the validation seems to work successfully without any exception or errors. But I need to align the <code>textbox</code> to make it properly displayed on the browser (Mozilla FireFox).</p>
  
  <p>The problem is, my validation <code>IS IN THE TABLE</code> seems not to be working and I keep encountering error that stated my <code>textbox</code> is null, when I clearly filled that textbox with the correct datatype.</p>
  
  <p>Here is my code:</p>
  
  <pre><code>&lt;table&gt;
  
    &lt;tr&gt;
      &lt;td&gt;&amp;nbsp;Customer name&amp;nbsp;&lt;/td&gt;
      &lt;td&gt;&lt;asp:TextBox ID="txtCustomerName0" runat="server" display="Dynamic" ValidationGroup="VG"&gt;&lt;/asp:TextBox&gt;&lt;/td&gt;
      &lt;td class="style1"&gt;
        &lt;asp:RequiredFieldValidator ID="RequiredFieldValidator2" runat="server"
          ErrorMessage="This field must be filled in"
          ControlToValidate="txtCustomerName0"
          ValidationGroup="VG" Display="Dynamic"&gt;&lt;/asp:RequiredFieldValidator&gt;&lt;/td&gt;
    &lt;/tr&gt;
  
    &lt;tr&gt;
      &lt;td&gt;&amp;nbsp;Contact&amp;nbsp;&lt;/td&gt;
      &lt;td&gt;&lt;asp:TextBox ID="txtContact0" runat="server" ValidationGroup="VG"&gt;&lt;/asp:TextBox&gt;&lt;/td&gt;
      &lt;td&gt;
        &lt;asp:CompareValidator ID="CompareValidator9" runat="server"
          ControlToValidate="txtContact0" ErrorMessage="Please put correct phone no."
          Operator="DataTypeCheck" Type="Integer"
          ValidationGroup="VG" Display="Dynamic"&gt;&lt;/asp:CompareValidator&gt;
      &lt;/td&gt;
    &lt;/tr&gt;
  
    &lt;tr&gt;
      &lt;td&gt;ProductCode&lt;/td&gt;
      &lt;td&gt;&lt;asp:TextBox ID="txtProductCode0" runat="server" ValidationGroup="VG"&gt;&lt;/asp:TextBox&gt;&lt;/td&gt;
      &lt;td&gt;&amp;nbsp;&lt;/td&gt;
    &lt;/tr&gt;
  
    &lt;tr&gt;
      &lt;td&gt;ProductName&lt;/td&gt;
      &lt;td&gt;&lt;asp:TextBox ID="txtProductName0" runat="server" ValidationGroup="VG"&gt;&lt;/asp:TextBox&gt;&lt;/td&gt;
      &lt;td&gt;&amp;nbsp;&lt;/td&gt;
    &lt;/tr&gt;
  
    &lt;tr&gt;
      &lt;td&gt;Description&lt;/td&gt;
      &lt;td&gt;&lt;asp:TextBox ID="txtDescription0" runat="server" ValidationGroup="VG"&gt;&lt;/asp:TextBox&gt;&lt;/td&gt;
      &lt;td&gt;&amp;nbsp;&lt;/td&gt;
    &lt;/tr&gt;
  
    &lt;tr&gt;
      &lt;td&gt;Address&lt;/td&gt;
      &lt;td&gt;&lt;asp:TextBox ID="txtAddress0" runat="server" ValidationGroup="VG"&gt;&lt;/asp:TextBox&gt;&lt;/td&gt;
      &lt;td&gt;&amp;nbsp;&lt;/td&gt;
    &lt;/tr&gt;
  
    &lt;tr&gt;
      &lt;td&gt;Quantity&lt;/td&gt;
      &lt;td&gt;&lt;asp:TextBox ID="txtQuantity0" runat="server" ValidationGroup="VG"&gt;&lt;/asp:TextBox&gt;&lt;/td&gt;
      &lt;td&gt;
        &lt;asp:CompareValidator ID="CompareValidator10" runat="server"
          ControlToValidate="txtQuantity0" ErrorMessage="Please put correct quantity"
          Operator="DataTypeCheck" Type="Integer"
          ValidationGroup="VG"&gt;&lt;/asp:CompareValidator&gt;
      &lt;/td&gt;
    &lt;/tr&gt;
  
    &lt;tr&gt;
      &lt;td&gt;UnitSalePrice&lt;/td&gt;
      &lt;td&gt;&lt;asp:TextBox ID="txtUnitSalePrice0" runat="server" ValidationGroup="VG"&gt;&lt;/asp:TextBox&gt;&lt;/td&gt;
      &lt;td&gt;
        &lt;asp:CompareValidator ID="CompareValidator11" runat="server"
          ControlToValidate="txtUnitSalePrice0" ErrorMessage="Please put correct price"
          Operator="DataTypeCheck" Type="Currency" 
          ValidationGroup="VG"&gt;&lt;/asp:CompareValidator&gt;
      &lt;/td&gt;
    &lt;/tr&gt;
  
    &lt;tr&gt;
      &lt;td&gt;Amount&lt;/td&gt;
      &lt;td&gt;&lt;asp:TextBox ID="txtAmount0" runat="server" ValidationGroup="VG"&gt;&lt;/asp:TextBox&gt;&lt;/td&gt;
      &lt;td&gt;
        &lt;asp:CompareValidator ID="CompareValidator12" runat="server"
          ControlToValidate="txtAmount0" ErrorMessage="Please put correct amount"
          Operator="DataTypeCheck" Type="Currency" 
          ValidationGroup="VG"&gt;&lt;/asp:CompareValidator&gt;
      &lt;/td&gt;
    &lt;/tr&gt;
  
    &lt;tr&gt;
      &lt;td&gt;RequiredDate&lt;/td&gt;
      &lt;td&gt;&lt;asp:TextBox ID="txtRequiredDate0" runat="server" ValidationGroup="VG"&gt;&lt;/asp:TextBox&gt;&lt;/td&gt;
      &lt;td&gt;
        &lt;asp:CompareValidator ID="CompareValidator13" runat="server"
          ControlToValidate="txtRequiredDate0"
          ErrorMessage="Please put correct date format" Operator="DataTypeCheck"
          Type="Date" ValidationGroup="VG"&gt;&lt;/asp:CompareValidator&gt;
      &lt;/td&gt;
    &lt;/tr&gt;
  
    &lt;tr&gt;
      &lt;td&gt;ConfirmedDate&lt;/td&gt;
      &lt;td&gt;&lt;asp:TextBox ID="txtConfirmedDate0" runat="server" ValidationGroup="VG"&gt;&lt;/asp:TextBox&gt;&lt;/td&gt;
      &lt;td&gt;
        &lt;asp:CompareValidator ID="CompareValidator14" runat="server"
          ControlToValidate="txtConfirmedDate0" 
          ErrorMessage="Please put correct date format" 
          Operator="DataTypeCheck" Type="Date" 
          ValidationGroup="VG"&gt;&lt;/asp:CompareValidator&gt;&lt;/td&gt;
    &lt;/tr&gt;
  
    &lt;tr&gt;
      &lt;td&gt;&lt;asp:Button ID="btnAdd" runat="server" onclick="btnAdd_Click" Text="ADD" ValidationGroup="VG" /&gt;&lt;/td&gt;
      &lt;td&gt;&lt;asp:Button ID="btnBack0" runat="server" onclick="btnHome_Click" Text="Back" /&gt;&lt;/td&gt;
      &lt;td&gt;&lt;/td&gt;
    &lt;/tr&gt;
  
  &lt;/table&gt;
  </code></pre>