Environment:
ASP.NET 3.5, VS2008 professional, C#, Windows7, IE8
RAD Control v 2010.1.309
I am creating an extended server control that inherits from the RadCombo box. The reason is that I want to be able to dynamically add asp.net validation controls based on a property (ValidatorCollection) that is set from the code behind of the containing page. I have successfully accomplished this with an asp.net text box (and other controls). I override the CreateChildControls method. Next I dynamically create the needed validation controls.
The odd thing is that the events seem to fire in a different order compared to other asp.net or Telerik controls (like the RadDateInput).
With ASP.NET controls the events fire in this order:
Hosting Web Page (uses a Master Page) OnInit fires
I set the ValidatorCollection property on the custom web control
On the Custom Control the RenderChildren fires
I dynamically create the needed ASP.NET validation controls.
On the custom Telerik ComboBox control
The ComboBox RenderChildren fires
No dynamic validator will be created since the ValidatorCollection will always be empty.
The hosting Page OnInit fires ….
I set the ValidatorCollection property, but it's too late, render Children already executed.
I tired the page OnPreInit, but it's to early and I get Object not set errors. I don't know if there's anything we can about this. I may just be the nature of a CompositeControl (which I believe the ComboBox is). But, any assistance would be appreciated!
Thanks!