feralmuppet
New Member
Hi,<BR>I have an asp text box on a page that I want a user to be able to put in a date (00/00/0000) and then to be able to click a search button and searh on that date. <BR><BR>The thing is that I want to put in a compare validator(?) to make sure that the date entered isn't later than the current date. I put the ControlToValidate as the text box, the ValueToCompare as a custom databind (Date.Now), and used GreaterThan and a Date compare. I get this error when I try and run the page: "You can't convert "" in ValueToCompare to type Date". <BR><BR>Any ideas??? Any help would be greatly appreciated. Thanks!<BR><BR>Regards,<BR>Peter TrimbleI hope this is what you need.<BR><BR>VB on load should be something like: txtDate.Text = Now.Today<BR><BR>And the validator you might want to use is:<BR><asp:CompareValidator id="CompareValidator1" style="Z-INDEX: 103; LEFT: 312px; POSITION: absolute; TOP: 176px" runat="server" ErrorMessage="Date cannot be after todays date." Width="120px" Height="40px" ControlToCompare="InputDate" ControlToValidate="txtDate" Operator="GreaterThanEqual" Type="Date"></asp:CompareValidator><BR><BR>Make sure the Type is "Date" or it will not perform correctly.Before you start all that, you might want to look here to make sure this IS what you want.<BR>http://www.ryandunn.us/asp+/Validate.aspx