Client side validation in asp.net forms

G

Guest

Hi

Has anyone any experience using client side validation with asp.net forms.

Specifically I'd like to know...

1. How do you attach client side code web controls (a button), like a
JavaScript 'onclick' event for example?
2. Any issues anyone has experienced using client side validation with
asp.net forms?

Thanks in advance

Simon Ames
 
K

Krishnan

All validator controls run on the client side unless scripting in the client
browser is switched off. Hence using validator controls will be equivalent
to writing "Onclick" event code on the client side.


Krishnan
 
A

Arvind P Rangan

Hi Simon,

Like you normally write a javascript and place it in regular place.
Only thing you have to do is.
for the button webcontrol add the following:
button.attribute.add("onClick","Javascript:return click();")
This has to be put in the page load so that this function is available when
the page is loaded.
i think this is what you want.
Anything else do reply.
ARvind.
 
J

Jos

Krishnan said:
All validator controls run on the client side unless scripting in the
client browser is switched off. Hence using validator controls will
be equivalent to writing "Onclick" event code on the client side.

Another condition is that the browser be IE.
ASP.NET client side validation doesn't work in Netscape.
 
P

Peter Blum

The button controls always use the client-side onclick event themselves for
running the client-side validation. You cannot just use
Button1.Atttributes.Add("onclick", "[your code]")
Instead, set Button1.CausesValidation = false to prevent it from generating
that code. Then add your code. If you want the client-side validation to
continue, the script is available by calling
Page.GetPostBackClientReference. For example:
Button1.Atttributes.Add("onclick", "[your code]" +
Page.GetPostBackClientReference(Button1, ""))

There are many issues with using client-side validation. In fact, there are
many issues with validation in general. I publish a replacement to
Microsoft's validations because there are so many limitations. Use this link
to see all the problems I found: http://www.peterblum.com/vam/valmain.aspx.
Even if you don't want my product ("Professional Validation And More" -
http://www.peterblum.com/vam/home.aspx), this list will help you plan your
development efforts better.

--- Peter Blum
www.PeterBlum.com
Email: (e-mail address removed)
Creator of "Professional Validation And More" at
http://www.peterblum.com/vam/home.aspx
 

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

Forum statistics

Threads
473,769
Messages
2,569,579
Members
45,053
Latest member
BrodieSola

Latest Threads

Top