473,657 Members | 2,484 Online
Bytes | Software Development & Data Engineering Community
+ Post

Home Posts Topics Members FAQ

Problem w/ Validation in UserControl with 2 controls on the same p

I've created a WebUserControl which is Composite Control. It includes
several controls including a few RangeValidator controls and a
ValidationSumma ry control. The WebUserControl works properly in most
situations, but I've discovered a problem when I place 2 or more of these
controls on the same page. Basically, the ValidationSumma ry control on each
of the WebUserControls seems to be displaying error messages for
RangeValidators on ALL instances of the WebUserControl on the page, not just
the one it is actually part of!

For testing and discussion purposes, I've created a simpler version o fthe
WebUserControl (i'll call it TestControl) that consists of:
1 TextBox
1 RangeValidator
1 ValidationSumma ry

I've set the RangeValidator to validate the TextBox for a range of Integers
between 0 and 9. So any single digit will be valid, any double digit (or
more) won't be.

I've then created a Default.aspx page and added the following controls to it:
2 TestControls
1 Button

I then build and browse to the page. And I find the following:

- If I enter a valid number in the TextBox of 1 TestControl and an invalid
number in the TextBox of the other TestControl and click the button, the
ValidationSumma ry of BOTH TestControls will display the RangeValidator' s
error message ONCE.

- If I enter invalid numbers in the TextBoxes of both TestControls and click
the button, the ValidationSumma ry of BOTH TestControls will display the
RangeValidator' s error message TWICE (presumably, once for each TextBox that
is not valid).

I've looked through the client-side script that is generated for the page
and it SEEMS to be ok. The controls on each TestControl are differentiated
in name/ID (i.e. TestControl1_Ra ngeValidator vs TestControl2_Ra ngeValidator,
etc...). Additionally, the problem still occurs if I turn off client-side
validation.

Note: I am using ASP.NET 2.0, but I don't know if this problem is specific
to that version of the framework or not.

Any thoughts?
Dec 28 '05 #1
3 1627
On Wed, 28 Dec 2005 13:39:03 -0800, dei1c3 wrote:
I've created a WebUserControl which is Composite Control. It includes
several controls including a few RangeValidator controls and a
ValidationSumma ry control. The WebUserControl works properly in most
situations, but I've discovered a problem when I place 2 or more of these
controls on the same page. Basically, the ValidationSumma ry control on each
of the WebUserControls seems to be displaying error messages for
RangeValidators on ALL instances of the WebUserControl on the page, not just
the one it is actually part of!

For testing and discussion purposes, I've created a simpler version o fthe
WebUserControl (i'll call it TestControl) that consists of:
1 TextBox
1 RangeValidator
1 ValidationSumma ry

I've set the RangeValidator to validate the TextBox for a range of Integers
between 0 and 9. So any single digit will be valid, any double digit (or
more) won't be.

I've then created a Default.aspx page and added the following controls to it:
2 TestControls
1 Button

I then build and browse to the page. And I find the following:

- If I enter a valid number in the TextBox of 1 TestControl and an invalid
number in the TextBox of the other TestControl and click the button, the
ValidationSumma ry of BOTH TestControls will display the RangeValidator' s
error message ONCE.

- If I enter invalid numbers in the TextBoxes of both TestControls and click
the button, the ValidationSumma ry of BOTH TestControls will display the
RangeValidator' s error message TWICE (presumably, once for each TextBox that
is not valid).

I've looked through the client-side script that is generated for the page
and it SEEMS to be ok. The controls on each TestControl are differentiated
in name/ID (i.e. TestControl1_Ra ngeValidator vs TestControl2_Ra ngeValidator,
etc...). Additionally, the problem still occurs if I turn off client-side
validation.

Note: I am using ASP.NET 2.0, but I don't know if this problem is specific
to that version of the framework or not.

Any thoughts?

Please include your test case.
Of the top of my head, the problem has to do with ids of the composite
controls; they should have their own namespace.

Dec 28 '05 #2
I am not sure whether it's changed in 2.0, but if you look into
WebUIValidation .js script that Microsoft used in 1.1, every ValidationSumma ry
control will loop through ALL enabled validators on the page - not sure how
to resolve your problem though - if you try to describe what is it that you
are trying to achieve - I may be able to suggest a work around...

"dei1c3" wrote:
I've created a WebUserControl which is Composite Control. It includes
several controls including a few RangeValidator controls and a
ValidationSumma ry control. The WebUserControl works properly in most
situations, but I've discovered a problem when I place 2 or more of these
controls on the same page. Basically, the ValidationSumma ry control on each
of the WebUserControls seems to be displaying error messages for
RangeValidators on ALL instances of the WebUserControl on the page, not just
the one it is actually part of!

For testing and discussion purposes, I've created a simpler version o fthe
WebUserControl (i'll call it TestControl) that consists of:
1 TextBox
1 RangeValidator
1 ValidationSumma ry

I've set the RangeValidator to validate the TextBox for a range of Integers
between 0 and 9. So any single digit will be valid, any double digit (or
more) won't be.

I've then created a Default.aspx page and added the following controls to it:
2 TestControls
1 Button

I then build and browse to the page. And I find the following:

- If I enter a valid number in the TextBox of 1 TestControl and an invalid
number in the TextBox of the other TestControl and click the button, the
ValidationSumma ry of BOTH TestControls will display the RangeValidator' s
error message ONCE.

- If I enter invalid numbers in the TextBoxes of both TestControls and click
the button, the ValidationSumma ry of BOTH TestControls will display the
RangeValidator' s error message TWICE (presumably, once for each TextBox that
is not valid).

I've looked through the client-side script that is generated for the page
and it SEEMS to be ok. The controls on each TestControl are differentiated
in name/ID (i.e. TestControl1_Ra ngeValidator vs TestControl2_Ra ngeValidator,
etc...). Additionally, the problem still occurs if I turn off client-side
validation.

Note: I am using ASP.NET 2.0, but I don't know if this problem is specific
to that version of the framework or not.

Any thoughts?

Dec 29 '05 #3
"Sergey Poberezovskiy" wrote:
I am not sure whether it's changed in 2.0, but if you look into
WebUIValidation .js script that Microsoft used in 1.1, every ValidationSumma ry
control will loop through ALL enabled validators on the page - not sure how
to resolve your problem though - if you try to describe what is it that you
are trying to achieve - I may be able to suggest a work around...


Yes...that's what I figured out after I posted. My assumption was that the
summary would be specific to the WebUserControl, but it encompasses the
entire page.

My work around was to remove the summary and layout the actual validators to
create a summary which worked fine.

Thanks anyway.
Dec 29 '05 #4

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

Similar topics

1
4019
by: Rhy Mednick | last post by:
I'm creating a custom control (inherited from UserControl) that is displayed by other controls on the form. I would like for the control to disappear when the user clicks outside my control the same way a menu does. To do this my control needs to get notified when the user tried to click off of it. The Leave and LostFocus events of the UserControl work most of the time but not always. For example, if they click on a part of the form...
1
1458
by: Sundaresan | last post by:
I've a form where I load two user controls dynamically. User Control-1 has a no.of dropdowns and based on the selection I typically populate a datagrid in the user control-2, Also the I could be loading a different usercontrol-2 based on the selections in usercontrol-1. Also I thought of passing the selection values through
0
1056
by: KB | last post by:
Hi guys, How to cause validation inside the UserControl without validating the whole form. I have controls that must be validated on both the form and in the UserControl. But in the UserControl it's separate from the form. Thanks in advance
2
2243
by: Eric Maia | last post by:
I have two UserControls I am using in a form. These are each also used separately in two other forms. The structure is essentially this: CourseUserControl.ascx - select or enter a course SessionUserControl.ascx - select or enter a course session CourseDetails.aspx - a form which contains just CourseUserControl CourseSessionDetails.aspx - a form which contains just SessionUserControl TrainingRequestDetails.aspx - a form which includes...
0
1142
by: koen | last post by:
Hi! In asp.net (version 1.1) I run into a problem when trying to perform client validation. The error I get on the client-side is : "Error: expected ';'". This problem occurs when I place a specific UserControl (that doesn't have validation) on a wepage together with other UserControls that do have validation.
10
4008
by: Charles Law | last post by:
For some reason, when I click the X to close my MDI parent form, the action appears to be re-directed to one of the MDI child forms, and the parent remains open. I am then unable to close the application. What should happen, is that the main MDI form should close, taking the child forms with it. There is code to loop through the child forms, remove the controls on each of them, and then close the form, but this code should execute only...
7
3795
by: Alon | last post by:
Hi, I'm making my own control which holds some buttons ant textboxes and also has a panel control. in design time i want to drop another controls into the panel that is in my usercontrol. the problem is that the added controls are added to the usercontrol and not to the panel... 10X,
2
452
by: moondaddy | last post by:
How can I have a page with 2 different groups of controls (where each group of controls contain textboxes, validation controls and a submit button) and each group operate independently? for example, when the user clicks on the first submit button, it wont submit unless all the controls in group 1 are valid, likewise, when the user clicks on the 2nd submit button, it wont submit unless all the controls in group 2 are valid. thanks.
0
1019
by: Nariban Barkan | last post by:
Hi All, I have two UserControls, KK1 and EFT1. Each one has one ScriptManagerProxy and one UpdatePanel . in addition to these, on first control (KK1) there is one button. on second control (EFT1), there are several textboxes , RequiredFieldValidators for textboxes and one button. I load these usercontrols via the PlaceHolders, like that;
0
8421
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 usage, and What is the difference between ONU and Router. Let’s take a closer look ! Part I. Meaning of...
0
8325
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 synchronization. With a Microsoft account, language settings sync across devices. To prevent any complications,...
0
8844
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. Here is my compilation command: g++-12 -std=c++20 -Wnarrowing bit_field.cpp Here is the code in...
0
8742
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 captivates audiences and drives business growth. The Art of Business Website Design Your website is...
1
8518
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 most users, this new feature is actually very convenient. If you want to control the update process,...
0
8621
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 choice of these technologies. I'm particularly interested in Zigbee because I've heard it does some...
1
6177
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 instead of User Defined Types (UDT). For example, to manage the data in unbound forms. Adolph will...
0
4173
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 the same network. But I'm wondering if it's possible to do the same thing, with 2 Pfsense firewalls...
2
1971
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.