ControlToValidate

Discussion in 'ASP .Net Building Controls' started by David, Jul 14, 2005.

  1. David

    David Guest

    Hi,

    I've created a custom server control that is essentially a control
    collection. Inside this is a textbox that I'm attempting to validate using a
    validation control assigned to the main control collection. I have a public
    property that exposes the internal textbox ID so the validation control can
    get it's ID to validate.

    I am running into issues where the validation control cannot, on some
    occasions, locate the textbox control due to an ID naming issue. I can get
    more specific but is there a general approach for something like this, other
    than putting the validation control inside this control collection?

    Thanks

    David
     
    David, Jul 14, 2005
    #1
    1. Advertising

  2. Trying to do this as well, in a few minutes. Have you mucked about
    with the .ClientId field, and not the .ID?
     
    Andrew Backer, Jul 18, 2005
    #2
    1. Advertising

  3. David

    David Guest

    Yes I have. Depending on the 'container' (eg. usercontrol or other control
    collection) the client ID can't be predetermined.

    "Andrew Backer" <> wrote in message
    news:...
    > Trying to do this as well, in a few minutes. Have you mucked about
    > with the .ClientId field, and not the .ID?
    >
     
    David, Jul 19, 2005
    #3
  4. True, though it depends on how many levels deep you are, right? If you
    are one level down (inside another user control), then you should be
    able to determine it from the parent's id (assigned in the aspx) plus
    "_" + the sub-control's id? At least thats what I do, but I have a
    fairly simple case. IE :

    _picker.ControlToSet = this.ID + "_" + _textbox.ID;

    Sorry that I can't help more...

    - Andrew
     
    Andrew Backer, Jul 20, 2005
    #4
    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. Steven Nagy

    Custom Control needs ControlToValidate

    Steven Nagy, Mar 6, 2007, in forum: ASP .Net
    Replies:
    4
    Views:
    597
    MasterGaurav \(www.edujini-labs.com\)
    May 8, 2007
  2. DaveyP
    Replies:
    1
    Views:
    680
    Chris Shepherd
    Apr 18, 2008
  3. Nathan Sokalski
    Replies:
    1
    Views:
    396
    bruce barker
    May 20, 2008
  4. Nathan Sokalski
    Replies:
    0
    Views:
    357
    Nathan Sokalski
    Mar 8, 2010
  5. Donal McWeeney

    custom validator and ControlToValidate in a composite control...

    Donal McWeeney, Sep 28, 2004, in forum: ASP .Net Building Controls
    Replies:
    1
    Views:
    224
    Donal McWeeney
    Sep 29, 2004
Loading...

Share This Page