Click here to Skip to main content
12,633,073 members (32,220 online)
Click here to Skip to main content
Add your own
alternative version

Tagged as

Stats

29.6K views
14 bookmarked
Posted

Enable or Disable ASP.NET Validation on Client Side

, 2 May 2011 CPOL
Rate this:
Please Sign up or sign in to vote.
How to enable or disable ASP.NET validation on client side

Introduction

Here is the solution to enable/disable ASP.NET validation using JavaScript.

Scenario: Suppose I have a dropdown which contains a list of Asian countries and Other when user is selecting Other than only txtOtherCity is enabled else disable, at that I disable the required field validation for Other city (rfvOtherCity).

//Syntax:
ValidatorEnable(ValidatorContronName,Boolean);
//Explanation:
ValidatorContronName:This is ClientID of the Validation control.
Boolean:true(Enable) or false(Disable)
//Example:
ValidatorEnable(document.getElementById('<%=rfvOtherCity.ClientID%>'), false);

Please provide a "Vote" if this would be helpfulhttps://www.codeproject.com/script/Forums/Images/rose.gif .

Thanks,
Imdadhusen

License

This article, along with any associated source code and files, is licensed under The Code Project Open License (CPOL)

Share

About the Author

Sunasara Imdadhusen
Software Developer (Senior) Infostretch Ahmedabad-Gujarat
India India
Aspiring for a challenging carrier wherein I can learn, grow, expand and share my existing knowledge in meaningful and coherent way.

sunaSaRa Imdadhusen


AWARDS:

  1. 2nd Best Mobile Article of January 2015

  2. 3rd Best Web Dev Article of May 2014

  3. 2nd Best Asp.Net article of MAY 2011

  4. 1st Best Asp.Net article of SEP 2010



Read More Articles...

You may also be interested in...

Pro

Comments and Discussions

 
GeneralMy vote of 5 Pin
Savalia Manoj M7-Nov-12 2:10
memberSavalia Manoj M7-Nov-12 2:10 
GeneralRe: My vote of 5 Pin
Sunasara Imdadhusen22-Apr-14 4:10
professionalSunasara Imdadhusen22-Apr-14 4:10 
QuestionDefinition of ValidatorEnable? Pin
tahir.h4-Oct-12 3:35
membertahir.h4-Oct-12 3:35 
AnswerRe: Definition of ValidatorEnable? Pin
Sunasara Imdadhusen4-Oct-12 3:59
memberSunasara Imdadhusen4-Oct-12 3:59 
GeneralThanks, this is not appreciation! Pin
Sunasara Imdadhusen22-Aug-11 17:57
memberSunasara Imdadhusen22-Aug-11 17:57 
GeneralReason for my vote of 1 to short. I would have preferred an... Pin
Mohammad_Denmark22-Aug-11 4:15
memberMohammad_Denmark22-Aug-11 4:15 
GeneralRe: Reason for my vote of 1to short. I would have preferred an... Pin
Sunasara Imdadhusen22-Apr-14 4:10
professionalSunasara Imdadhusen22-Apr-14 4:10 
GeneralThanks for finding bug. Pin
Sunasara Imdadhusen2-May-11 23:55
memberSunasara Imdadhusen2-May-11 23:55 
GeneralHi Sunasara, Fix the typo in last line of the code Validator... Pin
thatraja5-Mar-11 2:24
mvpthatraja5-Mar-11 2:24 
GeneralRe: Hi Sunasara,Fix the typo in last line of the codeValidator... Pin
Sunasara Imdadhusen22-Apr-14 4:11
professionalSunasara Imdadhusen22-Apr-14 4:11 
GeneralRe: Hi Sunasara,Fix the typo in last line of the codeValidator... Pin
thatraja22-Apr-14 4:13
protectorthatraja22-Apr-14 4:13 

General General    News News    Suggestion Suggestion    Question Question    Bug Bug    Answer Answer    Joke Joke    Praise Praise    Rant Rant    Admin Admin   

Use Ctrl+Left/Right to switch messages, Ctrl+Up/Down to switch threads, Ctrl+Shift+Left/Right to switch pages.

| Advertise | Privacy | Terms of Use | Mobile
Web02 | 2.8.161208.2 | Last Updated 3 May 2011
Article Copyright 2010 by Sunasara Imdadhusen
Everything else Copyright © CodeProject, 1999-2016
Layout: fixed | fluid