G
Guest
I've created a WebUserControl which is Composite Control. It includes
several controls including a few RangeValidator controls and a
ValidationSummary 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 ValidationSummary 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 ValidationSummary
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
ValidationSummary 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 ValidationSummary 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_RangeValidator vs TestControl2_RangeValidator,
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?
several controls including a few RangeValidator controls and a
ValidationSummary 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 ValidationSummary 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 ValidationSummary
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
ValidationSummary 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 ValidationSummary 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_RangeValidator vs TestControl2_RangeValidator,
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?