I have a composite control rougly like that::
====
class BlogComments : Control, INamingContainer, IPostBackEventHandler
{
Panel pAddComment;
TextBox tTitle;
protected override void CreateChildControls()
{
pAddComment = new Panel();
Controls.Add(pAddComment);
pAddComment.Controls.Add(tTitle = new TextBox());
tTitle.ID = "tTitle";
RequiredFieldValidator rfv = new RequiredFieldValidator();
rfv.ErrorMessage = strings.Required;
rfv.ControlToValidate = "tTitle";
pAddComment.Controls.Add(rfv);
}
}
====
Now when I try to display a page (.aspx) where there is a BlogComment I get the following error:
===
[HttpException (0x80004005): Unable to find control id 'tTitle' referenced by the 'ControlToValidate' property of ''.]
System.Web.UI.WebControls.BaseValidator.CheckContr olValidationProperty(String name, String propertyName) +221
System.Web.UI.WebControls.BaseValidator.ControlPro pertiesValid() +178
System.Web.UI.WebControls.BaseValidator.get_Proper tiesValid() +36
System.Web.UI.WebControls.BaseValidator.OnPreRende r(EventArgs e) +46
===
Any tips?
--
I have taken a vow of poverty. If you want to really piss me off, send me money.