title: How to get individual error labels to show C# asp.net
body: <p>I am working on a contact page and would like some help please on how to display error labels at individual times when the textboxes are empty. I have used 3 textboxes. I am a new student in C# asp.net. I really appreciate your time and help. Thanks!</p>
  
  <pre><code> //if no or incorrect entries are entered panel with red message using a label appears to remind the user of 
      //if name, email, enquiry is blank error labels show up
      if (nameContactUsTextBox.Text == "" &amp;&amp; emailContactUsTextBox.Text == "" &amp;&amp; enquiryContactUsTextBox.Text == "")
      {
          nameErrorLabel.Visible = true;
          emailErrorLabel.Visible = true;
          equiryErrorLabel.Visible = true;
      }
  
      if (nameContactUsTextBox.Text != "" &amp;&amp; emailContactUsTextBox.Text == "" &amp;&amp; enquiryContactUsTextBox.Text == "")
      {
  
          emailErrorLabel.Visible = true;
          equiryErrorLabel.Visible = true;
      }
  
      if (nameContactUsTextBox.Text == "" &amp;&amp; emailContactUsTextBox.Text != "" &amp;&amp; enquiryContactUsTextBox.Text == "")
      {
          nameErrorLabel.Visible = true;
          equiryErrorLabel.Visible = true;
      }
  
      if (nameContactUsTextBox.Text == "" &amp;&amp; emailContactUsTextBox.Text == "" &amp;&amp; enquiryContactUsTextBox.Text != "")
      {
          nameErrorLabel.Visible = true;
          emailErrorLabel.Visible = true;
  
      }
  </code></pre>
  
  <p>aspx file</p>
  
  <pre><code>&lt;p&gt;
      &lt;table style="width: 100%;"&gt;
          &lt;tr&gt;
              &lt;td class="boring"&gt;Name&lt;/td&gt;
              &lt;td class="auto-style1"&gt;
                  &lt;asp:TextBox ID="nameContactUsTextBox" runat="server" CssClass="boring" ToolTip="Enter Name" Width="441px"&gt;&lt;/asp:TextBox&gt;
                  &lt;asp:Label ID="nameErrorLabel" runat="server" CssClass="redalert" Text="*complete name" Visible="False"&gt;&lt;/asp:Label&gt;
              &lt;/td&gt;
          &lt;/tr&gt;
          &lt;tr&gt;
              &lt;td class="boring"&gt;E-Mail&lt;/td&gt;
              &lt;td&gt;
                  &lt;asp:TextBox ID="emailContactUsTextBox" runat="server" CssClass="boring" ToolTip="Enter Email" Width="443px"&gt;&lt;/asp:TextBox&gt;
                  &lt;asp:Label ID="emailErrorLabel" runat="server" CssClass="redalert" Text="*complete email" Visible="False"&gt;&lt;/asp:Label&gt;
              &lt;/td&gt;
          &lt;/tr&gt;
          &lt;tr&gt;
              &lt;td class="boring"&gt;Enquiry&lt;/td&gt;
              &lt;td class="auto-style5"&gt;
                  &lt;asp:TextBox ID="enquiryContactUsTextBox" runat="server" CssClass="classic" Height="158px" ToolTip="Enter Enquiry" Width="441px"&gt;&lt;/asp:TextBox&gt;
                  &lt;asp:Label ID="equiryErrorLabel" runat="server" CssClass="redalert" Text="*complete enquiry" Visible="False"&gt;&lt;/asp:Label&gt;
              &lt;/td&gt;
          &lt;/tr&gt;
          &lt;tr&gt;
              &lt;td class="auto-style5"&gt;&lt;/td&gt;
              &lt;td class="auto-style2"&gt;&lt;/td&gt;
          &lt;/tr&gt;
          &lt;tr&gt;
              &lt;td class="smallheader" colspan="2"&gt;&amp;nbsp;&lt;/td&gt;
          &lt;/tr&gt;
          &lt;tr&gt;
              &lt;td class="auto-style5"&gt;&amp;nbsp;&lt;/td&gt;
              &lt;td class="auto-style2"&gt;&amp;nbsp;&lt;/td&gt;
          &lt;/tr&gt;
          &lt;tr&gt;
              &lt;td class="auto-style5" colspan="2"&gt;
                  &lt;asp:Button ID="sendButton" runat="server" CssClass="smallheader" OnClick="sendButton_Click" Text="Send" ToolTip="Sending to NeoMan!" Width="200px" /&gt;
                  &lt;asp:Button ID="homeButton" runat="server" CssClass="smallheader" OnClick="homeButton_Click" Text="Home" ToolTip="Continue Shopping With NeoMan" Width="200px" /&gt;
                  &lt;asp:Button ID="resetButton" runat="server" CssClass="smallheader" OnClick="resetButton_Click" Text="Reset Form" ToolTip="Clear Form" Width="200px" /&gt;
              &lt;/td&gt;
          &lt;/tr&gt;
          &lt;tr&gt;
  </code></pre>