开发者

CompareValidator with aspCalendar

开发者 https://www.devze.com 2023-01-14 12:29 出处:网络
I ve two aspCalendar controls on the website. I would like to perform validation (date from Calendar2 should be greater then date from Calendar开发者_运维知识库 1).

I ve two aspCalendar controls on the website. I would like to perform validation (date from Calendar2 should be greater then date from Calendar开发者_运维知识库 1).

<asp:CompareValidator ID="CompareValidator1" runat="server"
    ErrorMessage="CompareValidator" 
    ControlToValidate="Calendar2" 
    Operator="GreaterThanEqual" 
    Type="Date" 
    ControlToCompare="Calendar1"
/>

There are a lot examples of validation but with ControlToValidate as textBox or label, What about more complex Controls, is there any way I can tell which property from that control has to be used?

Maybe Client side validation ? But how to do this ?

Thanks for help


I would recommend using a customvalidator, which gives you complete control over the way the validation occurs. The control to validate may not accept the calendar; however, you can point it to a textbox, but behind the scenes in the servervalidate function validate your calendars, and so that is a workaround to making the validators work with controls like the calendar.

You could use client validation, but it depends on what you are trying to validate and how easy it would be; there is a lot of markup with the calendar control, so that might be hard...

HTH.

0

精彩评论

暂无评论...
验证码 换一张
取 消