简体   繁体   English

回发后验证的asp CompareValidator

[英]asp CompareValidator validating after postback

Is there any reason an asp CompareValidator validates after postback. 在回发后,asp CompareValidator是否有任何理由进行验证。 ie everything runs when i click the button, and the error of the validator shows on the screen after postback. 即一切都运行当我单击按钮,并验证器的错误回发后在屏幕上显示。
i have a compare validator on 2 dates (datefrom and dateto). 我有2个日期(datefrom和dateto)的比较验证器。 if the dates are in gregorian format the validator works fine, but if the dates are in hijri format, the above scenario takes place. 如果日期采用公历格式,则验证器可以正常工作,但是如果日期采用hijri格式,则会发生上述情况。
this is my validator: 这是我的验证器:

  <asp:ValidCompareValidator ID="vcvDate" runat="server" ControlToValidate="cDateTo" ControlToCompare="cDateFrom" Operator="GreaterThanEqual" Type="Date" CultureInvariantValues="true" />

The control can't handle doing non-Gregorian comparisons on the client. 该控件无法处理客户端上的非格雷戈里式比较。 You'll have to do server-side validation (or use a custom validator). 您将必须进行服务器端验证(或使用自定义验证器)。

From the BaseCompareValidator.Type property page on MSDN: 从MSDN上的BaseCompareValidator.Type属性页:

When the Type property is set to Date and the current calendar type is non-Gregorian, the validator performs server-side validation only. 当“类型”属性设置为“ 日期”并且当前日历类型为非格雷戈里式时,验证器仅执行服务器端验证。 The validator client script supports only Gregorian calendars. 验证程序客户端脚本仅支持公历。

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM