Custom RadCombo events order different

2 posts, 0 answers
  1. Jerry
    Jerry avatar
    5 posts
    Member since:
    Aug 2010

    Posted 05 Sep 2010 Link to this post

    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 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 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 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!


  2. Calleigh
    Calleigh avatar
    9 posts
    Member since:
    Sep 2010

    Posted 09 Sep 2010 Link to this post

    It will be easier for you to solve the issue if you use a User Control instead of inheriting RadComboBox.
Back to Top