Unable to find control id referenced by the 'ControlToValidate' Pr

Discussion in 'ASP .Net Web Controls' started by vibs, Jan 24, 2006.

  1. vibs

    vibs Guest

    I am adding a textbox and a requiredvalidator control dynamically to a
    usercontrol, and I get this error on the validator control. I have tried
    changing to ClientID and UniqueID with no success. What am I missing? I am
    adding the control to the same TableCell so the container should be the same.

    Unable to find control id 'TaskNotesID$' referenced by the
    'ControlToValidate' property of 'TaskNotesID$Required'

    case "TextBox":
    TextBox cTextBox = (TextBox)ctrl;
    cTextBox.Text = "Test";
    mcell.Controls.Add(cTextBox);

    RequiredFieldValidator mReq = new RequiredFieldValidator();
    mReq.ControlToValidate = cTextBox.ID;
    mReq.ErrorMessage = "Error";
    mReq.Text = "*";
    mcell.Controls.Add(mReq);

    Thanks!
    Vibs
     
    vibs, Jan 24, 2006
    #1
    1. Advertisements

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. Sameer Sheikh
    Replies:
    1
    Views:
    988
    Natty Gur
    Jul 2, 2004
  2. Steven Nagy

    Custom Control needs ControlToValidate

    Steven Nagy, Mar 6, 2007, in forum: ASP .Net
    Replies:
    4
    Views:
    748
    MasterGaurav \(www.edujini-labs.com\)
    May 8, 2007
  3. Rahul
    Replies:
    5
    Views:
    570
    John Saunders [MVP]
    Mar 1, 2008
  4. Nathan Sokalski
    Replies:
    1
    Views:
    500
    bruce barker
    May 20, 2008
  5. Nathan Sokalski
    Replies:
    0
    Views:
    498
    Nathan Sokalski
    Mar 8, 2010
  6. Donal McWeeney

    custom validator and ControlToValidate in a composite control...

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

    Accessing the ControlToValidate control in a Validator

    Nathan Sokalski, May 20, 2008, in forum: ASP .Net Building Controls
    Replies:
    1
    Views:
    943
    bruce barker
    May 20, 2008
  8. Nathan Sokalski

    Accessing the ControlToValidate control in a Validator

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