473,386 Members | 1,766 Online
Bytes | Software Development & Data Engineering Community
Post Job

Home Posts Topics Members FAQ

Join Bytes to post your question to a community of 473,386 software developers and data experts.

Client side validation in asp.net forms

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
Nov 18 '05 #1
4 4116
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

<am*******@hotmail.com> wrote in message
news:eY**************@TK2MSFTNGP11.phx.gbl...
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

Nov 18 '05 #2
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.
<am*******@hotmail.com> wrote in message
news:eY**************@TK2MSFTNGP11.phx.gbl...
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

Nov 18 '05 #3
Jos
Krishnan wrote:
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.

--

Jos
Nov 18 '05 #4
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: PL****@PeterBlum.com
Creator of "Professional Validation And More" at
http://www.peterblum.com/vam/home.aspx

<am*******@hotmail.com> wrote in message
news:eY**************@TK2MSFTNGP11.phx.gbl...
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

Nov 18 '05 #5

This thread has been closed and replies have been disabled. Please start a new discussion.

Similar topics

2
by: Eric Linders | last post by:
Hi everyone. :-) Our site gets a ton of traffic on our contact forms, which collect the standard information (name, address, city, state, zip, home phone, etc.) The form validation is done with...
4
by: | last post by:
Hello Guys, I am using the validation controls to validate my data. But the problem is "The page is still being posted to server". I want to get rid of the round trips to server. Are there...
14
by: Matt | last post by:
I want to know if ASP.NET Web Forms Validation Controls are Server-Side or Client-Side form validation? Since I think each validator control can select either 1) JavaScript based error dialog or 2)...
5
by: Mong | last post by:
Hi, I have a webform with various asp controls on it such as textboxes and dropdownlists. I'm fairly new to asp.net coming from VB6 and am wondering when it's best to use client side events and...
1
by: rmgalante | last post by:
I have written an ASP.Net application that uses the standard client-side and server-side validation for various fields on the form. Some of the customers that use the form report symptoms that...
5
by: Sun Jian | last post by:
Hi, I am trying to customize the asp.net validation to achieve the following: Upon submitting the form, client side validation will run, and it will stop at the first error detected. For...
3
by: Guadala Harry | last post by:
I hope this is something I can solve without contacting the vendor: I'm implementing a 3rd party component that will, by itself, initiate a PostBack. Apparently it does not support the...
9
by: Alan Silver | last post by:
Hello, I have some simple client-side Javascript validation that was working fine until now. For some reason (don't ask me), it has stopped working and I can't figure out why. I have switched to...
2
by: goscottie | last post by:
I need to find a way to either 1. run and check all Validation controls (in my case one CompareValidator) and run client side javascript function. In this case I'll use <asp:Button>. So if all...
0
by: taylorcarr | last post by:
A Canon printer is a smart device known for being advanced, efficient, and reliable. It is designed for home, office, and hybrid workspace use and can also be used for a variety of purposes. However,...
0
by: Charles Arthur | last post by:
How do i turn on java script on a villaon, callus and itel keypad mobile phone
0
by: aa123db | last post by:
Variable and constants Use var or let for variables and const fror constants. Var foo ='bar'; Let foo ='bar';const baz ='bar'; Functions function $name$ ($parameters$) { } ...
0
by: ryjfgjl | last post by:
In our work, we often receive Excel tables with data in the same format. If we want to analyze these data, it can be difficult to analyze them because the data is spread across multiple Excel files...
0
BarryA
by: BarryA | last post by:
What are the essential steps and strategies outlined in the Data Structures and Algorithms (DSA) roadmap for aspiring data scientists? How can individuals effectively utilize this roadmap to progress...
1
by: nemocccc | last post by:
hello, everyone, I want to develop a software for my android phone for daily needs, any suggestions?
1
by: Sonnysonu | last post by:
This is the data of csv file 1 2 3 1 2 3 1 2 3 1 2 3 2 3 2 3 3 the lengths should be different i have to store the data by column-wise with in the specific length. suppose the i have to...
0
by: Hystou | last post by:
Most computers default to English, but sometimes we require a different language, especially when relocating. Forgot to request a specific language before your computer shipped? No problem! You can...
0
jinu1996
by: jinu1996 | last post by:
In today's digital age, having a compelling online presence is paramount for businesses aiming to thrive in a competitive landscape. At the heart of this digital strategy lies an intricately woven...

By using Bytes.com and it's services, you agree to our Privacy Policy and Terms of Use.

To disable or enable advertisements and analytics tracking please visit the manage ads & tracking page.