嘿..我想将当前日期与用户输入的日期进行比较..但是,到目前为止,我遇到了错误..
我试过这样的事情:
<asp:TextBox id="txtDate1" runat="server" />
<asp:CompareValidator runat="server" ErrorMessage="The date must be greater than today"
ControlToValidate="txtDate1" type="date"
ValuetoCompare="DateTime.Today.ToShortDateString()" />
Run Code Online (Sandbox Code Playgroud)
我得到一个错误,指出"" DateTime.Today.ToShortDateString()的ValueToCompare属性的值不能转换为类型'日期'我也尝试过ValueToCompare="DateTime.Now.Date()",我得到了相同的错误消息.
请帮助我,我非常感谢.