Validators and Dynamic Controls

Discussion in 'ASP .Net' started by psparago, Apr 7, 2005.

  1. psparago

    psparago Guest

    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
    psparago, Apr 7, 2005
    #1
    1. Advertising

  2. psparago

    Brock Allen Guest

    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
    Brock Allen, Apr 7, 2005
    #2
    1. Advertising

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

It takes just 2 minutes to sign up (and it's free!). Just click the sign up button to choose a username and then you can ask your own questions on the forum.
Similar Threads
  1. Christian H
    Replies:
    2
    Views:
    570
    Christian H
    Jul 23, 2003
  2. Ratman
    Replies:
    0
    Views:
    651
    Ratman
    Sep 14, 2004
  3. Ronald
    Replies:
    2
    Views:
    836
    Robbe Morris [C# MVP]
    Jan 17, 2006
  4. Nathan Sokalski

    Validators and IDs of other controls

    Nathan Sokalski, Feb 12, 2008, in forum: ASP .Net
    Replies:
    2
    Views:
    363
    Nathan Sokalski
    Feb 12, 2008
  5. Denny Smolinski via .NET 247

    Dynamic Controls, Placeholder, Retrieve Information from Dynamic Controls

    Denny Smolinski via .NET 247, May 4, 2004, in forum: ASP .Net Web Controls
    Replies:
    1
    Views:
    459
    Eidolon
    May 4, 2004
Loading...

Share This Page