Setting a server control property from the content page
<p>I need to validate a textbox to ensure the submit date is older than Today. I wanted to use a CompareValidator to do that, but unfortunately the following code doesn't work:</p>

<pre><code>&lt;asp:CompareValidator ID="cvtbDateExpiration" ControlToValidate="tbDateExpiration"
    Operator="GreaterThan" Type="Date" ValueToCompare="&lt;%= DateTime.Today %&gt;"   
    ErrorMessage="Card has expired" runat="server" /&gt;
</code></pre>

<p>The compiler tells me that <code>ValueToCompare="&lt;%= DateTime.Today %&gt;"</code> is wrong: "This is not scriptlet. Will be output as plain text."</p>

<p>Is there a simple way to achieve this (without setting it using the Code Behind)?</p>

<p>Thanks!</p>
