?
Solved

asp.net customvalidator tips

Posted on 2011-04-19
1
Medium Priority
?
273 Views
Last Modified: 2012-05-11
A Custom Validator can be quite tricky to get right.
Here are some tips that were used in a hairy validation.
For starters, lets assume that there is a checkbox and textbox that work together in validation.

1. Add a textbox which is non-empty to act as the ControlToValidate in the CustomValidator.
    Set style="display:none" so it doesn't display.
    Other code will be looking for it, and gripe if it is null.
2. Assign the ErrorMessage in the CustomValidator.
    You can't set it an client run time.
3. Provide OnServerValidate function in code-behind.
4. Add ClientValidationFunction
    Set args.IsValid = true or false

No response needed.
0
Comment
Question by:brotherbill999
1 Comment
 
LVL 31

Accepted Solution

by:
MlandaT earned 80 total points
ID: 35428795
thanks for the tips :)
0

Featured Post

Upgrade your Question Security!

Add Premium security features to your question to ensure its privacy or anonymity. Learn more about your ability to control Question Security today.

Question has a verified solution.

If you are experiencing a similar issue, please ask a related question

Boost your ability to deliver ambitious and competitive web apps by choosing the right JavaScript framework to best suit your project’s needs.
Today, the web development industry is booming, and many people consider it to be their vocation. The question you may be asking yourself is – how do I become a web developer?
The viewer will learn the basics of jQuery, including how to invoke it on a web page. Reference your jQuery libraries: (CODE) Include your new external js/jQuery file: (CODE) Write your first lines of code to setup your site for jQuery.: (CODE)
The viewer will learn the basics of jQuery including how to code hide show and toggles. Reference your jQuery libraries: (CODE) Include your new external js/jQuery file: (CODE) Write your first lines of code to setup your site for jQuery…
Suggested Courses
Course of the Month14 days, 15 hours left to enroll

840 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question