Wrox Programmer Forums
Go Back   Wrox Programmer Forums > ASP.NET and ASP > ASP.NET 1.0 and 1.1 > ASP.NET 1.0 and 1.1 Basics
|
ASP.NET 1.0 and 1.1 Basics ASP.NET discussion for users new to coding in ASP.NET 1.0 or 1.1. NOT for the older "classic" ASP 3 or the newer ASP.NET 2.0.
Welcome to the p2p.wrox.com Forums.

You are currently viewing the ASP.NET 1.0 and 1.1 Basics section of the Wrox Programmer to Programmer discussions. This is a community of software programmers and website developers including Wrox book authors and readers. New member registration was closed in 2019. New posts were shut off and the site was archived into this static format as of October 1, 2020. If you require technical support for a Wrox book please contact http://hub.wiley.com
 
Old December 19th, 2005, 04:47 AM
Registered User
 
Join Date: Aug 2005
Posts: 6
Thanks: 0
Thanked 0 Times in 0 Posts
Default using javascript for server control validation

hi
in my webpage i've 3 textboxes and one submit button.all are sercontrols.i like use javascript for validtion of controls on client side.also want to set the focus in the respective controls when the validation failed.
plz give me some sample code.any suggestion is welcome

with regards
swagatika

 
Old December 19th, 2005, 08:42 AM
planoie's Avatar
Friend of Wrox
 
Join Date: Aug 2003
Posts: 5,407
Thanks: 0
Thanked 16 Times in 16 Posts
Default

ASP.NET has several built in controls for clientside validation. These are the validation server controls and live in the System.Web.UI.WebControls namespace.
Theh validators derive from the BaseValidator class. You can see what those validators are on the MSDN page for that class:

http://msdn.microsoft.com/library/en...classtopic.asp


-Peter
 
Old December 20th, 2005, 06:23 AM
Registered User
 
Join Date: Aug 2005
Posts: 6
Thanks: 0
Thanked 0 Times in 0 Posts
Default

hi
i want to use javascript for the webcontrols in client side.
further if validation failed then cursor should be focus in the respective controls.i want to give the message to the user about the error in a meassge box.i don't want to use built in controls for validation.
how to do this.plz help me.:(

 
Old December 20th, 2005, 08:38 AM
planoie's Avatar
Friend of Wrox
 
Join Date: Aug 2003
Posts: 5,407
Thanks: 0
Thanked 16 Times in 16 Posts
Default

You posted this question in an ASP.NET forum, so I thus assumed that you were looking for an ASP.NET solution.

You will have to write you own javascript methods to do the validation the way you wish. There is a server control called the CustomValidator. Here's the MSDN article about it:

http://msdn.microsoft.com/library/en...classtopic.asp

Using that web control you can point it at your own custom javascript methods that do the validation.

If you still don't want to use ANY ASP.NET controls, then you might want to try posting the question in a JavaScript forum.

-Peter





Similar Threads
Thread Thread Starter Forum Replies Last Post
javascript datetime validation Hannibal Javascript 1 December 5th, 2007 06:39 AM
diff b/w javascript validation & server side valid ashu VS.NET 2002/2003 1 March 27th, 2007 09:30 AM
how to get ID of server-control in Javascript? hertendreef ASP.NET 2.0 Basics 0 June 15th, 2006 12:05 PM
Javascript validation for apostrophe crmpicco Javascript How-To 2 March 2nd, 2005 06:57 AM





Powered by vBulletin®
Copyright ©2000 - 2020, Jelsoft Enterprises Ltd.
Copyright (c) 2020 John Wiley & Sons, Inc.