By using this site, you agree to our updated Privacy Policy and our Terms of Use. Manage your Cookies Settings.
459,905 Members | 1,585 Online
Bytes IT Community
+ Ask a Question
Need help? Post your question and get tips & solutions from a community of 459,905 IT Pros & Developers. It's quick & easy.

Validators and Dynamic Controls

P: n/a
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

Nov 19 '05 #1
Share this Question
Share on Google+
1 Reply


P: n/a
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.

-Brock
DevelopMentor
http://staff.develop.com/ballen
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


Nov 19 '05 #2

This discussion thread is closed

Replies have been disabled for this discussion.