473,394 Members | 1,828 Online
Bytes | Software Development & Data Engineering Community
Post Job

Home Posts Topics Members FAQ

Join Bytes to post your question to a community of 473,394 software developers and data experts.

Can we validate a control on a part of the page?

Hello .Net Experts,

I am building an aspx page. Inside it, I have a Send Mail form, with controls: name, email and message and a "Send Mail" button.
On another area of the page, I have another button, when clicking it, a dynamic image will change (It's ajax based).

Now I have added a "RequiredFieldValidator" to the "Email TextField" , to make sure the email is entered by the user before he press on "Send Mail".

This is working amazingly, but the only problem is, if I don't want to send the email, instead, I would like to click the other button which change the image on the other side of the page, the image doesn't change, and I see the validator on the other side saying "Email Required!" .

I definitely understand that this is happening because I should place the email, but is it possible to make an area for the validation, where we can work normally outside it without validation?

Please suggest.

Best regards,
Wassim
Feb 25 '08 #1
2 995
Hi Wassim
You can use validationGroup Property of Validation Control for both controls like Email Address RequiredFieldValidator and The Send Mail button.

Say You have btnSendMail (SendEmail), btnSendImage(SendImage) and reqFldvalid(RequiredFieldValidator) email address (textbox).

1. Click the RequiredFieldValidator control and in the ValidationGroup property specify btnSendMail.
2. Click the btnSendMail control and in the ValidationGroup property specify btnSendMail.

Now run the page once you click the SendImage the validation won;t fire but once you click SendMail button you will see the error if the email address box is empty.

Hope this helps.

Hello .Net Experts,

I am building an aspx page. Inside it, I have a Send Mail form, with controls: name, email and message and a "Send Mail" button.
On another area of the page, I have another button, when clicking it, a dynamic image will change (It's ajax based).

Now I have added a "RequiredFieldValidator" to the "Email TextField" , to make sure the email is entered by the user before he press on "Send Mail".

This is working amazingly, but the only problem is, if I don't want to send the email, instead, I would like to click the other button which change the image on the other side of the page, the image doesn't change, and I see the validator on the other side saying "Email Required!" .

I definitely understand that this is happening because I should place the email, but is it possible to make an area for the validation, where we can work normally outside it without validation?

Please suggest.

Best regards,
Wassim
Feb 25 '08 #2
Hi Wassim
You can use validationGroup Property of Validation Control for both controls like Email Address RequiredFieldValidator and The Send Mail button.

Say You have btnSendMail (SendEmail), btnSendImage(SendImage) and reqFldvalid(RequiredFieldValidator) email address (textbox).

1. Click the RequiredFieldValidator control and in the ValidationGroup property specify btnSendMail.
2. Click the btnSendMail control and in the ValidationGroup property specify btnSendMail.

Now run the page once you click the SendImage the validation won;t fire but once you click SendMail button you will see the error if the email address box is empty.

Hope this helps.

Hello,

I Followed the steps and it's working amazingly now.
A million thanks for your help :)

Best regards,
Wassim
Feb 25 '08 #3

Sign in to post your reply or Sign up for a free account.

Similar topics

0
by: Christopher H. Laco | last post by:
I have a web user control that, like most, has a couple of fields with their corrisponding validators. What I want to do is perform some other lookup inside of the control if all of the validators...
4
by: Mr. x | last post by:
Hello, I know about the validator on : http://validator.w3.org , which can validate html pages. I just new to this validator. How can I validate (if it can be - by this validator) aspx pages,...
4
by: owingruters | last post by:
Hi all, I've created an User control. It's an extension of a textbox wich has some extra properties so that validation becomes a lot faster. The control wordks great if autopostback is on....
5
by: Jim Heavey | last post by:
When should you use the Page.Validate() method? I thought you would use this method if you have some Server side validation (CustomControl's) you wanted to use and this would cause them to be...
11
by: wolf | last post by:
There are three webcontrol on my asp.net form: a TextBox, a submit button and a RegularExpressionValidator. And I had set ControlToValidate property of the RegularExpressionValidator to the...
3
by: Martin | last post by:
Hi, I am implemeting a form in asp.net. The form is quite large and the validation is reasonably complex, so I have decieded to implement my own validation rather than use any custon...
1
by: Joey | last post by:
Does anyone know how to validate only one certain control in server side code on postback? Instead of Page.Validate() and Page.IsValid, is there some functionality equivalent to...
1
by: Smokey Grindle | last post by:
to start off with the page the free text box (version 3) is on has validateRequest="false" in the page directive already... but even with that when I am in the page and then click on a link to...
11
by: jjbutera | last post by:
I know how to use the ErrorProvider in my winforms..or do I? I validate the values and set the ErrorProvider in the validating event. If not valid, I set e.Cancel = True. I clear the ErrorProvider...
5
by: Seb | last post by:
Hi, I am trying to find the right regular expression which would only validate a URL with a given number of folders. Example: http://www.abc.com/folder/page.htm --Valid (4 slahes)
0
by: ryjfgjl | last post by:
If we have dozens or hundreds of excel to import into the database, if we use the excel import function provided by database editors such as navicat, it will be extremely tedious and time-consuming...
0
by: ryjfgjl | last post by:
In our work, we often receive Excel tables with data in the same format. If we want to analyze these data, it can be difficult to analyze them because the data is spread across multiple Excel files...
0
by: emmanuelkatto | last post by:
Hi All, I am Emmanuel katto from Uganda. I want to ask what challenges you've faced while migrating a website to cloud. Please let me know. Thanks! Emmanuel
0
BarryA
by: BarryA | last post by:
What are the essential steps and strategies outlined in the Data Structures and Algorithms (DSA) roadmap for aspiring data scientists? How can individuals effectively utilize this roadmap to progress...
1
by: Sonnysonu | last post by:
This is the data of csv file 1 2 3 1 2 3 1 2 3 1 2 3 2 3 2 3 3 the lengths should be different i have to store the data by column-wise with in the specific length. suppose the i have to...
0
by: Hystou | last post by:
There are some requirements for setting up RAID: 1. The motherboard and BIOS support RAID configuration. 2. The motherboard has 2 or more available SATA protocol SSD/HDD slots (including MSATA, M.2...
0
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,...
0
by: Hystou | last post by:
Most computers default to English, but sometimes we require a different language, especially when relocating. Forgot to request a specific language before your computer shipped? No problem! You can...
0
Oralloy
by: Oralloy | last post by:
Hello folks, I am unable to find appropriate documentation on the type promotion of bit-fields when using the generalised comparison operator "<=>". The problem is that using the GNU compilers,...

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.