This is a migrated thread and some comments may be shown as answers.

Custom RadCombo events order different

1 Answer 69 Views
ComboBox
This is a migrated thread and some comments may be shown as answers.
Jerry
Top achievements
Rank 1
Jerry asked on 06 Sep 2010, 12:37 AM

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!

1 Answer, 1 is accepted

Sort by
0
Calleigh
Top achievements
Rank 1
answered on 09 Sep 2010, 01:43 PM
It will be easier for you to solve the issue if you use a User Control instead of inheriting RadComboBox.
Tags
ComboBox
Asked by
Jerry
Top achievements
Rank 1
Answers by
Calleigh
Top achievements
Rank 1
Share this question
or