stop execution in Custom validator if it false
<p>i have two textboxes as to_date and from_date.  and i compare both textboxes and get value but it execution goes next to onclick of button that i want to stop because if to_date is less than from date, the to date is become null as well as focus on that textboxes not goes to click event of button.</p>

<p>i use :</p>

<pre><code> try
        {
            DateTime from = DateTime.ParseExact(txt_from_date.Text, "M/d/yyyy", theCultureInfo);
            DateTime to = DateTime.ParseExact(txt_to_date.Text, "M/d/yyyy", theCultureInfo);
            int result = DateTime.Compare(to, from);
            e.IsValid = result&gt;0;
            if (e.IsValid == false)
            {
                txt_to_date.Text = "";
                txt_to_date.Focus();
            }
        }
        catch (Exception eq)
        {
            e.IsValid = false;
            txt_to_date.Text = "";
        }
</code></pre>
