Solved

How to make custom validations of a requiredfieldvaildator control ?

Posted on 2008-10-20
1
361 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

Instantly Create Instructional Tutorials

Contextual Guidance at the moment of need helps your employees adopt to new software or processes instantly. Boost knowledge retention and employee engagement step-by-step with one easy solution.

Question has a verified solution.

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

Suggested Solutions

A quick way to get a menu to work on our website, is using the Menu control and assign it to a web.sitemap using SiteMapDataSource. Example of web.sitemap file: (CODE) Sample code to add to the page menu: (CODE) Running the application, we wi…
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…
Nobody understands Phishing better than an anti-spam company. That’s why we are providing Phishing Awareness Training to our customers. According to a report by Verizon, only 3% of targeted users report malicious emails to management. With compan…
In a recent question (https://www.experts-exchange.com/questions/29004105/Run-AutoHotkey-script-directly-from-Notepad.html) here at Experts Exchange, a member asked how to run an AutoHotkey script (.AHK) directly from Notepad++ (aka NPP). This video…

710 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