Solved

How to make custom validations of a requiredfieldvaildator control ?

Posted on 2008-10-20
1
368 Views
Last Modified: 2008-10-20
HI

A form contains a couple of controls (textbox) that have associated a RequiredFieldValidator, I need to make mandatory just one at the time but it depends on the button clicked (there are two buttons too).

Something like this:

if BUTTON_A was pressed then
     TEXTBOX_A must be mandatory and TEXTBOX_B doesn´t matter
else
    viceversa
endif

Thanks.
0
Comment
Question by:dimensionav
[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 15

Accepted Solution

by:
jorge_toriz earned 250 total points
ID: 22761472
<asp:TextBox id="txtA" runat="server"/>
<asp:RequieredFieldValidator id="rfvA" runat="server" ControlToValidate="txtA" ValidationGroup="GroupA"/>

<asp:TextBox id="txtB" runat="server"/>
<asp:RequieredFieldValidator id="rfvB" runat="server" ControlToValidate="txtB" ValidationGroup="GroupB"/>

<asp:Button id="cmdA" runat="server" ValidationGroup="GroupA"/>
<asp:Button id="cmdB" runat="server" ValidationGroup="GroupB"/>

You must use validation groups
0

Featured Post

Industry Leaders: 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

Today is the age of broadband.  More and more people are going this route determined to experience the web and it’s multitude of services as quickly and painlessly as possible. Coupled with the move to broadband, people are experiencing the web via …
It was really hard time for me to get the understanding of Delegates in C#. I went through many websites and articles but I found them very clumsy. After going through those sites, I noted down the points in a easy way so here I am sharing that unde…
In this video, viewers will be given step by step instructions on adjusting mouse, pointer and cursor visibility in Microsoft Windows 10. The video seeks to educate those who are struggling with the new Windows 10 Graphical User Interface. Change Cu…
Do you want to know how to make a graph with Microsoft Access? First, create a query with the data for the chart. Then make a blank form and add a chart control. This video also shows how to change what data is displayed on the graph as well as form…

617 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