Solved

ASP.NET : CustomValidator control does not validate!

Posted on 2003-11-14
1
3,005 Views
Last Modified: 2008-03-03
In my asp.net page i have a textbox and two checkboxes.I added a custom validator control and set its onservervalidate property to a vb.net server side function. This function basically checks that if either one of the two checkboxes is checked, the user must enter something in the textbox. Now during runtime, if the user does not type anything in the textbox and checks the checkbox, the validation function isnt fired.On the other hand if the user types something in the textbox, the function is fired and of course the validation passes the test.

Any ideas anyone?

thanks
0
Comment
Question by:arvindsha
[X]
Welcome to Experts Exchange

Add your voice to the tech community where 5M+ people just like you are talking about what matters.

  • Help others & share knowledge
  • Earn cash & points
  • Learn & ask questions
1 Comment
 
LVL 2

Accepted Solution

by:
sergey_okhotny earned 125 total points
ID: 9823185
If you do not set property ControlToValidate of your customvalidator, then validate function will be fired each time.
In function you'll check checkbox status and textbox value and, if something is bad,then set args.IsValid=false;
0

Featured Post

Technology Partners: We Want Your Opinion!

We value your feedback.

Take our survey and automatically be enter to win anyone of the following:
Yeti Cooler, Amazon eGift Card, and Movie eGift Card!

Question has a verified solution.

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

Suggested Solutions

Title # Comments Views Activity
illegal characters in XML using UTF-8 8 44
How can I write .htaccess code to redirect 301 pages? 1 135
Form submit issue 11 89
Problem to ToolkitScriptManager 2 76
Styling your websites can become very complex. Here I'll show how SASS can help you better organize, maintain and reuse your CSS code.
SASS allows you to treat your CSS code in a more OOP way. Let's have a look on how you can structure your code in order for it to be easily maintained and reused.
Viewers will learn about basic arrays, how to declare them, and how to use them. Introduction and definition: Declare an array and cover the syntax of declaring them: Initialize every index in the created array: Example/Features of a basic arr…
The viewer will learn how to create a basic form using some HTML5 and PHP for later processing. Set up your basic HTML file. Open your form tag and set the method and action attributes.: (CODE) Set up your first few inputs one for the name and …

733 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