Validators and Dynamic Controls

P

psparago

I have developed a tab user control in which each tab is itself a user
control and the tab selection control is a datalist.

Each tabbed user control has zero or more validator controls on it. The
hosting page has a summary validator on it.

Each tabbed user control is created dynamically on page_init (on both
postback and not postback), but only the tabbed user control which
corresponds to the selected tab is marked as visible. This has the
effect of only the selected tabbed user control being rendered to the
output page.

Validation works as expected for the selected tabbed user control.
However, when the page is submitted, the summary validator can only
validate the selected tabbed user control (on the client).

What I want to do, is on submit, run through all of the validators on
the page and determine if any of the tabbed user controls that were not
active when the page was submitted have errors.

(A secondary desire is to be able to do a summary validation on the
page that is being deselected when a different tab is selected, but
I'll save that for another time.)

In my event handler for the submit button, I iterate through the
Validators collection and call Validate() on each IValidator object.
Even though one of the tabbed user controls have an error, that
validator (a RequiredValidator) says it is valid.

Does this ring any bells with anyone?

thanks
peter
 
B

Brock Allen

You can always diable the validaiton on individual validation controls. So
you could have all the validators on all tabs, but then disable them all
except for the ones on the current tab. I don't know how appealing that approach
is to you.
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Similar Threads

Dynamic controls and postback. 0
Dynamic Validators 0
AJAX and validators 2
Validators 1
Dynamic Validators 0
Validators on dynamic UserControls 3
Validators 3
multiview and validators 0

Members online

Forum statistics

Threads
473,968
Messages
2,570,153
Members
46,701
Latest member
XavierQ83

Latest Threads

Top