title: How do I check two textboxes for two dates
body: <p>One has txtDateReceived and second has txtVendorPackDate. Before insert will add record I have to check if txtDateReceived is not erlier then txtVendorPackDate. I try use TextChanged event. </p>
  
  <pre><code>protected void txtVendorPackDate_TextChanged(object sender, EventArgs e)
  {
      DateTime fromDate = DateTime.MinValue;
      DateTime toDate = DateTime.MaxValue;
      bool parseResultMin = DateTime.TryParse(txtVendorPackDate.Text, out fromDate);
      bool parseResultMax = DateTime.TryParse(txtDateReceived.Text, out toDate);
      if (toDate &lt; fromDate)
      {
          txtVendorPackDate.Text = "";
          lblDateExpired.Visible = true;
          lblDateExpired.Text = "Selected date is incorrect, please enter correct data.";
          txtVendorFatPerc.Focus();
      }
  
      double expired = toDate.Subtract(fromDate).TotalDays;
  
      if (expired &gt;= 60)
      {
  
          lblDateExpired.Text = "Date Expired " + expired + " days after pack day!!!" 
          lblDateExpired.Visible = true;
      }  
  } 
  </code></pre>
  
  <p>How I could do it from client side not using controls validation.</p>