Jump to content
Xtreme .Net Talk

Recommended Posts

Posted

Im using a compare validator to make sure the date entered is greater than today.. I have the exact same code (below) on two different aspx pages.. One works ... one doesn't.. . The CompareValidator that works is contained in an EditItemTemplate of a DataGrid were as the comparevalidator that isnt working is just on a page. Any ideas why this isnt working?? Or know a better way to accomplish this?

 

Thanks!

 

<asp:CompareValidator id=cvalEditExpiry runat="server" ErrorMessage="Expiry date must be greater than today in MM/DD/YYYY format" Display="None" ControlToValidate="txtEditExpiry" Type="Date" Operator="GreaterThanEqual" ValueToCompare="<%# DateTime.Today.ToShortDateString() %>"> </asp:CompareValidator>

 

Heres the error message.

 

The value '' of the ValueToCompare property of 'cvalExpiry' cannot be converted to type 'Date'.

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.

Guest
Reply to this topic...

×   Pasted as rich text.   Paste as plain text instead

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.

×
×
  • Create New...