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. 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:
    581
    MasterGaurav \(www.edujini-labs.com\)
    May 8, 2007
  2. Nathan Sokalski
    Replies:
    1
    Views:
    379
    bruce barker
    May 20, 2008
  3. Nathan Sokalski
    Replies:
    0
    Views:
    338
    Nathan Sokalski
    Mar 8, 2010
  4. Donal McWeeney

    custom validator and ControlToValidate in a composite control...

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

    Accessing the ControlToValidate control in a Validator

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

Share This Page