Easy access to the control specified in a validator's ControlToValidate property

Discussion in 'ASP .Net' started by Nathan Sokalski, Mar 8, 2010.

  1. I have a custom validator that inherits from BaseValidator, and I need to be
    able to access the control specified by the ControlToValidate property. The
    only way I have been able to find to do this is to recursively use the
    FindControl method, which can sometimes be inefficient depending on where
    the control is located. I'm sure I'm not the first person to want to access
    the ControlToValidate control in a custom validator, so does anybody know of
    a more efficient way? Thanks.
    --
    Nathan Sokalski

    http://www.nathansokalski.com/
     
    Nathan Sokalski, Mar 8, 2010
    #1
    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. Nathan Sokalski
    Replies:
    1
    Views:
    411
    bruce barker
    May 20, 2008
  2. Donal McWeeney

    custom validator and ControlToValidate in a composite control...

    Donal McWeeney, Sep 28, 2004, in forum: ASP .Net Building Controls
    Replies:
    1
    Views:
    236
    Donal McWeeney
    Sep 29, 2004
  3. Nathan Sokalski

    Accessing the ControlToValidate control in a Validator

    Nathan Sokalski, May 20, 2008, in forum: ASP .Net Building Controls
    Replies:
    1
    Views:
    824
    bruce barker
    May 20, 2008
  4. Jeff
    Replies:
    6
    Views:
    250
    KMILO
    May 2, 2005
  5. Nathan Sokalski

    Accessing the ControlToValidate control in a Validator

    Nathan Sokalski, May 20, 2008, in forum: ASP .Net Web Controls
    Replies:
    1
    Views:
    174
    bruce barker
    May 20, 2008
Loading...

Share This Page