Velocity Reviews - Computer Hardware Reviews

Velocity Reviews > Newsgroups > Programming > ASP .Net > Validators and Dynamic Controls

Reply
Thread Tools

Validators and Dynamic Controls

 
 
psparago
Guest
Posts: n/a
 
      04-07-2005
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

 
Reply With Quote
 
 
 
 
Brock Allen
Guest
Posts: n/a
 
      04-07-2005
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




 
Reply With Quote
 
 
 
Reply

Thread Tools

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is On
HTML code is Off
Trackbacks are On
Pingbacks are On
Refbacks are Off


Similar Threads
Thread Thread Starter Forum Replies Last Post
Validators and IDs of other controls Nathan Sokalski ASP .Net 2 02-12-2008 10:10 PM
Dynamic Controls created by Dynamic Controls Ronald ASP .Net 2 01-17-2006 12:44 AM
Regular Expression validators NOT working, Required Field validators ARE working Ratman ASP .Net 0 09-14-2004 09:36 PM
Dynamic Controls, Placeholder, Retrieve Information from Dynamic Controls Denny Smolinski via .NET 247 ASP .Net Web Controls 1 05-04-2004 09:15 PM
dynamically add controls and validators - always false Christian H ASP .Net 2 07-23-2003 09:07 AM



Advertisments