I am trying to create a composite control that contains a RequiredFieldValidator but I'm having a few problems. The CreateChildControls method looks something like this -
Controls.Add(New TextBox())
Dim rfv as New RequiredFieldValidator()
rfv.ControlToValidate = Me.Controls(0).UniqueId
Controls.Add(rfv)
When I run it I get an error -
Unable to find control id 'mff1$ct100' referenced by the 'ControlToValidate property of
mff1$ct100 is the value of the name property of the textbox if I render the page without the RequiredFieldValidator (at which time it renders without issue).
There must be some way of creating a composite control containing a RequiredFieldValidator, what's the secret?
Cheers
Martin
"A common mistake that people make when trying to design something completely foolproof is to underestimate the ingenuity of complete fools."Douglas Adams