473,547 Members | 2,553 Online
Bytes | Software Development & Data Engineering Community
+ Post

Home Posts Topics Members FAQ

Validate over several Web User Controls

Hi everyone,

This is a scenerio for my problem,

I have one aspx page with several instances of the same Web User
Control (ascx files).

I have for example the Web User Control that has a textbox that
requires a numeric value (I am using the RequiredField, and
RangeValidator here with no problems)

What I also need to validate, is that 1 (and only 1) instance of the
Web User Control is given a textbox value 0, while all the others
must be == 0.

Any advice?
Thanks

Aug 17 '07 #1
2 1395
On Aug 17, 5:28 pm, Moistly <pfranc...@gmai l.comwrote:
Hi everyone,

This is a scenerio for my problem,

I have one aspx page with several instances of the same Web User
Control (ascx files).

I have for example the Web User Control that has a textbox that
requires a numeric value (I am using the RequiredField, and
RangeValidator here with no problems)

What I also need to validate, is that 1 (and only 1) instance of the
Web User Control is given a textbox value 0, while all the others
must be == 0.

Any advice?
Thanks
Hi Moistly,

I think that you should do the following:

1) add a public property for web user control that will contain the
value of textbox:

public int Value
{
get { return Convert.ToInt32 (TextBox1.Text) ; }
}

2) add CustomValidator to page where you placed a few instances of web
user controls. In CustomControl function check Value of all web user
controls and if only one has Value 0 then return true in other way -
false.

Regards,
Alexander Kleshchevnikov.
MCP
www.klalex.com

Aug 17 '07 #2
On Aug 17, 4:25 pm, seigo <seigo...@gmail .comwrote:
On Aug 17, 5:28 pm, Moistly <pfranc...@gmai l.comwrote:
Hi everyone,
This is a scenerio for my problem,
I have one aspx page with several instances of the same Web User
Control (ascx files).
I have for example the Web User Control that has a textbox that
requires a numeric value (I am using the RequiredField, and
RangeValidator here with no problems)
What I also need to validate, is that 1 (and only 1) instance of the
Web User Control is given a textbox value 0, while all the others
must be == 0.
Any advice?
Thanks

Hi Moistly,

I think that you should do the following:

1) add a public property for web user control that will contain the
value of textbox:

public int Value
{
get { return Convert.ToInt32 (TextBox1.Text) ; }

}

2) add CustomValidator to page where you placed a few instances of web
user controls. In CustomControl function check Value of all web user
controls and if only one has Value 0 then return true in other way -
false.

Regards,
Alexander Kleshchevnikov.
MCPwww.klalex.c om
Thanks alot, that does indeed work.
Aug 20 '07 #3

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

Similar topics

7
2222
by: Byron | last post by:
I have several user controls that have a few methods in common, such LoadFromForm() which populates an object from controls on the form. I want to call that method from the form in which the control is contained regardless of the type currently displayed without having to use a huge switch somthing like: switch(curentUserType.GetType()) {...
3
4816
by: Wm. Scott Miller | last post by:
Hello all: I'd like some advice on the best way to validate and confirm an e-mail address entered during a registration process. What we are thinking of is something like the following: 1. User comes to our web site and validates themselves as a member of our database. 2. User creates a user name and password to be used to log in to...
4
4274
by: Wysiwyg | last post by:
I need to validate a form to ensure that all of the fields add up correctly. I can't do this while the user is entering data since validation needs to be done after the entry is completed. What's the "best" way to validate prior to submitting? I could add an onsubmit attribute to the form which executes the validation in Javascript. That...
9
6653
by: B-Dog | last post by:
I have a form that has about 10 text boxes on it, they all have to be filled out before submitting is there a quick way to make sure that none are null or do I have to call out each textbox? Say something like textbox1 through textbox10? Thanks
1
4416
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 another page (as long as its changing pages, not posting back) it says this System.Web.HttpException was unhandled by user code...
11
11743
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 in the validated event. Is there a way to know if all validated controls pass validation when the user clicks an OK button? In ASP.Net there's...
1
3978
by: SkipNRun | last post by:
I am a novice when comes to JavaScript, AJAX. I am working on a form, which will allow users to update their contact information. In order to make the form flexible, I need to use pull down list. Depends on the pull down list selection, I use script.aculo.us to validate the user input before submit and pass the necessary data, such as contact...
5
1866
by: Ganesh | last post by:
Hi There, I need to validate email address with regular expression control, i tried something like this ^+*@*\.*$ but i need to validate even if it is blank, it should say invalid email, but don't want to use another requirefield validator
3
2405
by: ton | last post by:
Hi, I'm using AJAXPRO this works very well. What I want to do is to add new page elements at my web site without using a postback. And I do not mean listitems but a complete dialog. Let me give an example: in my application which will contain of several pages I'll use a filter/query mechanism, so if the user wants to add a new filter...
0
7510
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
7437
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 effortlessly switch the default language on Windows 10 without reinstalling. I'll walk you through it. First, let's disable language...
0
7703
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, it seems that the internal comparison operator "<=>" tries to promote arguments from unsigned to signed. This is as boiled down as I can make it. ...
0
7947
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
7463
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
6032
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
1923
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
1050
muto222
by: muto222 | last post by:
How can i add a mobile payment intergratation into php mysql website.
0
748
bsmnconsultancy
by: bsmnconsultancy | last post by:
In today's digital era, a well-designed website is crucial for businesses looking to succeed. Whether you're a small business owner or a large corporation in Toronto, having a strong online presence can significantly impact your brand's success. BSMN Consultancy, a leader in Website Development in Toronto offers valuable insights into creating...

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.