ERROR on Custom Validation in c#
<p>Error is:</p>

<p>String was not recognized as a valid DateTime.</p>

<p>Function of Custom Validator:</p>

<pre><code>protected void chkdate1(object sender, ServerValidateEventArgs e)
{
    IFormatProvider theCultureInfo = new System.Globalization.CultureInfo("en-GB", true);
    DateTime from = DateTime.ParseExact(txt_from_date.Text, "MM/dd/yyyy HH:mm:ss", theCultureInfo);
    DateTime to = DateTime.ParseExact(txt_to_date.Text, "MM/dd/yyyy HH:mm:ss", theCultureInfo);
}
</code></pre>

<p>Custom Validation is:</p>

<pre><code>&lt;asp:CustomValidator ID="scdt1" runat="server" OnServerValidate="chkdate1" ErrorMessage="To date not less than From date"&gt;
</code></pre>
