Trigger a Subset of Multiple Validators (Client-Side)

Discussion in 'ASP .Net' started by Jordan S., May 16, 2008.

  1. Jordan S.

    Jordan S. Guest

    I'm experimenting with dynamically inserting custom composite Web server
    controls onto a page. For testing purposes I have two custom composite Web
    server controls that each have a couple of TextBox controls and a "submit"
    button, as well as required field validators for each of the textboxes.

    What I'm finding is that when both of these Web server controls appearon the
    page, clicking on the "submit" button of either of the controls causes
    validation of *both* Web server controls' TextBox controls.

    Just wondering:
    1. Is this by design?... that ASP.NET would cause all client-side validators
    to run whenever any Submit button is clicked?

    2. Is there any way to trigger the client-side validators for ONLY the
    custom Web Server control to which the validators are explicitly tied?

    I understand that we can set a .CausesValidation property to be False - but
    that setting applies for all time. What I'd like is some way to have
    client-side validation happen for one set of controls when one Submit button
    is clicked; but when a different Submit button is clicked validate a
    completely different set of controls.

    Thanks.
    Jordan S., May 16, 2008
    #1
    1. Advertising

  2. "Jordan S." <> wrote in message
    news:O3UK$...
    > I'm experimenting with dynamically inserting custom composite Web server
    > controls onto a page. For testing purposes I have two custom composite Web
    > server controls that each have a couple of TextBox controls and a "submit"
    > button, as well as required field validators for each of the textboxes.
    >
    > What I'm finding is that when both of these Web server controls appearon
    > the page, clicking on the "submit" button of either of the controls causes
    > validation of *both* Web server controls' TextBox controls.
    >
    > Just wondering:
    > 1. Is this by design?... that ASP.NET would cause all client-side
    > validators to run whenever any Submit button is clicked?


    if you are using .NET 1.1 then yes this is by design but you can work around
    it by using a CustomValidator

    > 2. Is there any way to trigger the client-side validators for ONLY the
    > custom Web Server control to which the validators are explicitly tied?


    in .NET 2.0 you set the ValidationGroup property of the validator controls
    and the submit button. when the submit button is clicked only the validator
    controls in the same ValidationGroup will be checked

    >
    > I understand that we can set a .CausesValidation property to be False -
    > but that setting applies for all time. What I'd like is some way to have
    > client-side validation happen for one set of controls when one Submit
    > button is clicked; but when a different Submit button is clicked validate
    > a completely different set of controls.
    >
    > Thanks.
    >


    --
    Misbah Arefin
    https://mcp.support.microsoft.com/profile/MISBAH.AREFIN
    http://dotnethitman.spaces.live.com
    http://www.linkedin.com/in/misbaharefin
    Misbah Arefin, May 16, 2008
    #2
    1. Advertising

  3. Jordan S.

    Jordan S. Guest

    Very good. Thank you! I'm using .NET 3.5, so the ValidationGroup property is
    apparently what I'm needing.

    -J


    "Misbah Arefin" <> wrote in message
    news:...
    > "Jordan S." <> wrote in message
    > news:O3UK$...
    >> I'm experimenting with dynamically inserting custom composite Web server
    >> controls onto a page. For testing purposes I have two custom composite
    >> Web server controls that each have a couple of TextBox controls and a
    >> "submit" button, as well as required field validators for each of the
    >> textboxes.
    >>
    >> What I'm finding is that when both of these Web server controls appearon
    >> the page, clicking on the "submit" button of either of the controls
    >> causes validation of *both* Web server controls' TextBox controls.
    >>
    >> Just wondering:
    >> 1. Is this by design?... that ASP.NET would cause all client-side
    >> validators to run whenever any Submit button is clicked?

    >
    > if you are using .NET 1.1 then yes this is by design but you can work
    > around it by using a CustomValidator
    >
    >> 2. Is there any way to trigger the client-side validators for ONLY the
    >> custom Web Server control to which the validators are explicitly tied?

    >
    > in .NET 2.0 you set the ValidationGroup property of the validator controls
    > and the submit button. when the submit button is clicked only the
    > validator controls in the same ValidationGroup will be checked
    >
    >>
    >> I understand that we can set a .CausesValidation property to be False -
    >> but that setting applies for all time. What I'd like is some way to have
    >> client-side validation happen for one set of controls when one Submit
    >> button is clicked; but when a different Submit button is clicked validate
    >> a completely different set of controls.
    >>
    >> Thanks.
    >>

    >
    > --
    > Misbah Arefin
    > https://mcp.support.microsoft.com/profile/MISBAH.AREFIN
    > http://dotnethitman.spaces.live.com
    > http://www.linkedin.com/in/misbaharefin
    >
    >
    >
    Jordan S., May 16, 2008
    #3
    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. John Livermore

    Client side validators not emitting

    John Livermore, Jul 18, 2003, in forum: ASP .Net
    Replies:
    1
    Views:
    387
    John Livermore
    Jul 18, 2003
  2. news.microsoft.com

    validators subset

    news.microsoft.com, May 27, 2004, in forum: ASP .Net
    Replies:
    1
    Views:
    350
    Peter Blum
    May 27, 2004
  3. Ratman
    Replies:
    0
    Views:
    649
    Ratman
    Sep 14, 2004
  4. Stuart Whiteford
    Replies:
    2
    Views:
    741
    Stuart Whiteford
    Apr 25, 2006
  5. Matt
    Replies:
    1
    Views:
    148
    Brynn
    Jan 18, 2004
Loading...

Share This Page