Still celebrating National IT Professionals Day with 3 months of free Premium Membership. Use Code ITDAY17

x
?
Solved

How to make custom validations of a requiredfieldvaildator control ?

Posted on 2008-10-20
1
Medium Priority
?
369 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 1000 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

VIDEO: THE CONCERTO CLOUD FOR HEALTHCARE

Modern healthcare requires a modern cloud. View this brief video to understand how the Concerto Cloud for Healthcare can help your organization.

Question has a verified solution.

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

Calculating holidays and working days is a function that is often needed yet it is not one found within the Framework. This article presents one approach to building a working-day calculator for use in .NET.
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…
This course is ideal for IT System Administrators working with VMware vSphere and its associated products in their company infrastructure. This course teaches you how to install and maintain this virtualization technology to store data, prevent vuln…
In this video you will find out how to export Office 365 mailboxes using the built in eDiscovery tool. Bear in mind that although this method might be useful in some cases, using PST files as Office 365 backup is troublesome in a long run (more on t…

671 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