clienside validation for user controls

C

cplatzer

Hi,
I have created a custom control that represents a date-input. It
consists of a textbox and a button which opens a popup calendar.
Now when I have two of those date-inputs, I want to ensure that the
user doesn't enter a date in the second input that is smaller than that
in the first. I am using a comparevalidator to compare these two user
controls.
I have added a property called Text which returns the tex-property of
it's textbox and I have set <ValidationPropertyAttribute("Text")> in
the class-Definition.
However the validation only works server-side.
I have read somewhere (sadly I don't find the text anymore) that
clientside validation is only possible for controls that render their
value on the html-page (which my control does since it's value is the
value of a textbox ). However, the text didn't tell me how to tell the
validator that it can do clientside validation with my control.

Does anybody know how to do that?

Thanks in advance,
Christian
 
C

cplatzer

I just noticed that my problem seems to be even bigger:

The server-side validation doesn't really work either:
When I enter wrong dates and then do a postback the message of the
validator is shown BUT I can still press any button on the page and
they still work like no error was present.

I don't have any problems with validators that directly validate
textboxes, thoug...
 
S

Santhi Maadhaven

cplatzer,
With Validator we wont be able to do client side script. Add th
script event to the server control like
srvContrlname.Attributes.Add("onClick","javascript:Test();");
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Members online

No members online now.

Forum statistics

Threads
473,768
Messages
2,569,574
Members
45,051
Latest member
CarleyMcCr

Latest Threads

Top