在我的网络应用程序中,我编写了比较验证器来比较两个日期[从和到目前为止],但它显示错误。我的Comparevalidator是这样的。
<asp:CompareValidator ID="CompareValidator1" runat="server" Text="*" Display="None" ValidationGroup ="a" ControlToValidate="txtTo" ValueToCompare="txtFrom" Operator="GreaterThan" Type ="Date"
ErrorMessage="Date Should Greater Than From Date"></asp:CompareValidator>
答案 0 :(得分:2)
你应该使用&#34; ControlToCompare&#34;属性而不是&#34; ValueToCompare&#34;属性。
喜欢关注
<asp:CompareValidator ID="CompareValidator1" runat="server" Text="*" Display="None" ValidationGroup ="a" ControlToValidate="txtTo" ControlToCompare="txtFrom" Operator="GreaterThan" Type ="Date"
ErrorMessage="Date Should Greater Than From Date"></asp:CompareValidator>