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

V

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
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Members online

No members online now.

Forum statistics

Threads
473,755
Messages
2,569,536
Members
45,009
Latest member
GidgetGamb

Latest Threads

Top