473,569 Members | 2,759 Online
Bytes | Software Development & Data Engineering Community
+ Post

Home Posts Topics Members FAQ

RequiredFieldVa lidator

Does anyone know exactly how a RequiredFieldVa lidator works?

Here is my situation.

I am now in charge of a new project.

I am making a new contactus.aspx page with required fields.
Easy to do, not an issue.

The left navigaion has a user control (Newsletter Signup Control) that
allows you to sign up for newsletters and contains an email Textbox and
submit button.

This user control has RequiredFieldVa lidator on it as well.

When I submit information on the main section of the contactus.aspx
form and click submit, it forces me to fill in the required fields in
the user control as well.

Does anyone know how to have 2 different areas of required fileds on
the same page like this?

So I want to be able submit the contactus.aspx page without also having
to enter information into the user control and vise-versa.

Thanks

Mar 10 '06 #1
4 2167
In ASP.NET 1.x there is no good way to do this, so I hope you are using
ASP.NET 2.0 which makes this easy. You can configure separate validation
groups to do exactly what you've described.

Here's more info:
http://SteveOrr.net/articles/Validation.aspx
http://weblogs.asp.net/scottgu/archi...24/246945.aspx

If you're definitely stuck in ASP.NET 1.1 here's a possible solution:
http://weblogs.asp.net/eporter/archi...15/422630.aspx

--
I hope this helps,
Steve C. Orr, MCSD, MVP
http://SteveOrr.net
<jo************ @yahoo.com> wrote in message
news:11******** **************@ v46g2000cwv.goo glegroups.com.. .
Does anyone know exactly how a RequiredFieldVa lidator works?

Here is my situation.

I am now in charge of a new project.

I am making a new contactus.aspx page with required fields.
Easy to do, not an issue.

The left navigaion has a user control (Newsletter Signup Control) that
allows you to sign up for newsletters and contains an email Textbox and
submit button.

This user control has RequiredFieldVa lidator on it as well.

When I submit information on the main section of the contactus.aspx
form and click submit, it forces me to fill in the required fields in
the user control as well.

Does anyone know how to have 2 different areas of required fileds on
the same page like this?

So I want to be able submit the contactus.aspx page without also having
to enter information into the user control and vise-versa.

Thanks

Mar 10 '06 #2
Set the button's CausesValidatio n =False

HTH

Elton Wang

"jo************ @yahoo.com" wrote:
Does anyone know exactly how a RequiredFieldVa lidator works?

Here is my situation.

I am now in charge of a new project.

I am making a new contactus.aspx page with required fields.
Easy to do, not an issue.

The left navigaion has a user control (Newsletter Signup Control) that
allows you to sign up for newsletters and contains an email Textbox and
submit button.

This user control has RequiredFieldVa lidator on it as well.

When I submit information on the main section of the contactus.aspx
form and click submit, it forces me to fill in the required fields in
the user control as well.

Does anyone know how to have 2 different areas of required fileds on
the same page like this?

So I want to be able submit the contactus.aspx page without also having
to enter information into the user control and vise-versa.

Thanks

Mar 10 '06 #3
look on the web.
it is full of samples

<jo************ @yahoo.com> wrote in message
news:11******** **************@ v46g2000cwv.goo glegroups.com.. .
Does anyone know exactly how a RequiredFieldVa lidator works?

Here is my situation.

I am now in charge of a new project.

I am making a new contactus.aspx page with required fields.
Easy to do, not an issue.

The left navigaion has a user control (Newsletter Signup Control) that
allows you to sign up for newsletters and contains an email Textbox and
submit button.

This user control has RequiredFieldVa lidator on it as well.

When I submit information on the main section of the contactus.aspx
form and click submit, it forces me to fill in the required fields in
the user control as well.

Does anyone know how to have 2 different areas of required fileds on
the same page like this?

So I want to be able submit the contactus.aspx page without also having
to enter information into the user control and vise-versa.

Thanks

Mar 10 '06 #4
If you're using net 2.0 then you can group your validators and only do the ones you want.

If you're using v1.1 then what I've done is to disable all validators when they're created, and enabled the specific ones you want
to verify on each button click event handler.

The following routine switches all validators on for a page, but you could modify it just to enable the validators you want..

Public Sub ToggleValidator s(ByVal bToggle As Boolean)
Dim bv As BaseValidator
For Each bv In Page.Validators
bv.Enabled = bToggle
Next
End Sub

I also, enable the validator for the specific control in any onchange event, easily done if you set your validator ID to the same ID
as your control but with "_validator " added to the end. In the onchange events, you can then do something like..

Dim CV As CustomValidator
Dim doChange As Boolean = True
Dim ID As String = CType(source, CustomValidator ).ControlToVali date

CV = FindControl(ID + "_validator ")
If Not CV Is Nothing Then
CV.Enabled = True
CV.Validate()
doChange = CV.IsValid
End If
If doChange Then
' do onchange processing
End If

HTH
--
Adrian Parker
Ingenuity At Work Ltd

<jo************ @yahoo.com> wrote in message news:11******** **************@ v46g2000cwv.goo glegroups.com.. .
Does anyone know exactly how a RequiredFieldVa lidator works?

Here is my situation.

I am now in charge of a new project.

I am making a new contactus.aspx page with required fields.
Easy to do, not an issue.

The left navigaion has a user control (Newsletter Signup Control) that
allows you to sign up for newsletters and contains an email Textbox and
submit button.

This user control has RequiredFieldVa lidator on it as well.

When I submit information on the main section of the contactus.aspx
form and click submit, it forces me to fill in the required fields in
the user control as well.

Does anyone know how to have 2 different areas of required fileds on
the same page like this?

So I want to be able submit the contactus.aspx page without also having
to enter information into the user control and vise-versa.

Thanks

Mar 10 '06 #5

This thread has been closed and replies have been disabled. Please start a new discussion.

Similar topics

6
2143
by: BK | last post by:
I'm having a really strange problem with and HtmlSelect server control (listbox) and a RequiredFieldValidator that I am trying to use to make sure that someone has items in the listbox. The way that the HtmlSelect is populated is via a combination of client-side javascript and another aspx page (launched by the javascript). Anyway,...
0
2021
by: Nicolas | last post by:
How can I have only one RequiredFieldValidator to control two TextBox webcontrols so that only one message is displayed <asp:Label id="lbl_UserName" runat="server"></asp:Label><br> <asp:TextBox id="txt_UserName" runat="server"></asp:TextBox> <asp:RequiredFieldValidator id="R_lbl_UserName" runat="server" ControlToValidate="txt_UserName"...
3
2941
by: me | last post by:
Is there any particular reason why a requiredfieldvalidator cant validate a listbox? I have bound the two together but the validator always returns false on isvalid and so does the Page, no matter if the user selects an item in the listbox or not.
7
8939
by: Ed West | last post by:
Hello, I have a simple form with some input boxes. After validation if one fails, then I would like to at the top of the page say something like "The following fields in red are required" and then change the label in front of the textbox or dropdown list to red... is this possible with asp.net? It seems you can only put a...
4
10026
by: James | last post by:
Hello, I have a RequiredFieldValidator for several textbox controls on a form. Here's an example with the RequiredFieldValidator. EnableClientScript, Enabled, and Visible are set to true for the RequiredFieldValidator. <asp:textbox id="FirstName" MaxLength="25" runat="server"></asp:textbox>
4
5094
by: Joe | last post by:
Hello, I have created a login page using dotnet. I am using requiredFieldValidator and noticed that the code works fine in IE but not in Netscape, Opera, Mozilla, Firefox, etc. For example if I do not enter anything in the form in IE, then form won't be submitted but in other browsers it is submitted. I checked that JavaScript is...
5
3233
by: Fernando Lopes | last post by:
Hi. I want to show an image in a requiredfield validator instead of "*". So, I 'm set the requiredfieldvalidator attributes like following: <asp:RequiredFieldValidator id=rfvFirstName ControlToValidate="AddressName" Display="Dynamic" ErrorMessage="First Name Is Required" Runat="server" CssClass="AlertText"
2
2087
by: Hongbo | last post by:
Hi, I have a Asp.Net written in C#. It serve as information input form. The form encounters sort of random problem with the email field and state field. I have validator attached with these 2 fields as the following: ===== <form id="creditcardform" method="post" runat="server"> Email: <asp:textbox id="txtBillEmail" maxlength="50"...
1
5993
by: Giovanni | last post by:
Dear Friends, I need your help. I am trying to dynamically create a RequiredFieldValidator in the ItemCreated event of a DataList but cannot get it to work. The errors seem to revolve around the .ControlToValidate property. When a new Item is created, I check the information coming in from my database. Based on a field value (TypeID),...
2
6453
by: Christina | last post by:
Hello !! I am creating a dynamic textbox and want to validate it using the requiredfieldvalidator. These are the steps which I tried: ==================================================== 1) In Page_load, Dim Email As New Label
0
7698
marktang
by: marktang | last post by:
ONU (Optical Network Unit) is one of the key components for providing high-speed Internet services. Its primary function is to act as an endpoint device located at the user's premises. However, people are often confused as to whether an ONU can Work As a Router. In this blog post, we’ll explore What is ONU, What Is Router, ONU & Router’s main...
0
8122
jinu1996
by: jinu1996 | last post by:
In today's digital age, having a compelling online presence is paramount for businesses aiming to thrive in a competitive landscape. At the heart of this digital strategy lies an intricately woven tapestry of website design and digital marketing. It's not merely about having a website; it's about crafting an immersive digital experience that...
1
7673
by: Hystou | last post by:
Overview: Windows 11 and 10 have less user interface control over operating system update behaviour than previous versions of Windows. In Windows 11 and 10, there is no way to turn off the Windows Update option using the Control Panel or Settings app; it automatically checks for updates and installs any it finds, whether you like it or not. For...
0
7970
tracyyun
by: tracyyun | last post by:
Dear forum friends, With the development of smart home technology, a variety of wireless communication protocols have appeared on the market, such as Zigbee, Z-Wave, Wi-Fi, Bluetooth, etc. Each protocol has its own unique characteristics and advantages, but as a user who is planning to build a smart home system, I am a bit confused by the...
0
6284
agi2029
by: agi2029 | last post by:
Let's talk about the concept of autonomous AI software engineers and no-code agents. These AIs are designed to manage the entire lifecycle of a software development project—planning, coding, testing, and deployment—without human intervention. Imagine an AI that can take a project description, break it down, write the code, debug it, and then...
1
5513
isladogs
by: isladogs | last post by:
The next Access Europe User Group meeting will be on Wednesday 1 May 2024 starting at 18:00 UK time (6PM UTC+1) and finishing by 19:30 (7.30PM). In this session, we are pleased to welcome a new presenter, Adolph Dupré who will be discussing some powerful techniques for using class modules. He will explain when you may want to use classes...
0
3653
by: TSSRALBI | last post by:
Hello I'm a network technician in training and I need your help. I am currently learning how to create and manage the different types of VPNs and I have a question about LAN-to-LAN VPNs. The last exercise I practiced was to create a LAN-to-LAN VPN between two Pfsense firewalls, by using IPSEC protocols. I succeeded, with both firewalls in...
1
2113
by: 6302768590 | last post by:
Hai team i want code for transfer the data from one system to another through IP address by using C# our system has to for every 5mins then we have to update the data what the data is updated we have to send another system
1
1213
muto222
by: muto222 | last post by:
How can i add a mobile payment intergratation into php mysql website.

By using Bytes.com and it's services, you agree to our Privacy Policy and Terms of Use.

To disable or enable advertisements and analytics tracking please visit the manage ads & tracking page.