Home All Groups Group Topic Archive Search About

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

Author
24 Jan 2006 4:28 PM
vibs
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

Author
24 Jan 2006 5:24 PM
vibs
Nevermind. I figured it out. Thanks!!

Show quoteHide quote
"vibs" wrote:

> 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