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

Adding child controls to a RadGrid derived class

2 Answers 93 Views
Grid
This is a migrated thread and some comments may be shown as answers.
Justavian
Top achievements
Rank 1
Justavian asked on 01 Jun 2011, 07:39 PM
I have a class derived from RadGrid, to which i would like to add a hidden input and possibly other controls.  I'd like to put those at the root level - adding them to the main div (so that these added controls would be siblings of the MasterTableView), but it doesn't seem possible.  I've tried overriding CreateChildControls, OnLoad, PreRender, and other functions, at which point i'd try to do a simple this.controls.add().  But the controls i add in this manner never get rendered out to the page - regardless of which function i'm in.

The only way i've been able to render those controls out is if i add them to a cell in the command item.  But that command row won't always be visible, so that doesn't seem like a very solid solution.

Any ideas?  What's the best way to add child controls to a RadGrid derived class?  Preferably without resorting to turning the whole thing into a composite control.

-RP

2 Answers, 1 is accepted

Sort by
0
Justavian
Top achievements
Rank 1
answered on 02 Jun 2011, 03:58 AM
I'm not sure if it will have any repercussions later on, but i discovered that i *can* use PreRender - but only if i add my additional controls *after* my call to Rebind().  Apparently Rebind will remove any foreign controls.
0
Justavian
Top achievements
Rank 1
answered on 02 Jun 2011, 04:54 PM
As it turns out, my hidden field does not hold its state if it's added in PreRender after the ReBind().  It also doesn't seem to maintain state if it's added during a data bind.  Looks like i might have to reconsider turning this into a composite control.

So i ask again - anyone have any idea how to add controls to a RadGrid derived class such that they maintain their state?
Tags
Grid
Asked by
Justavian
Top achievements
Rank 1
Answers by
Justavian
Top achievements
Rank 1
Share this question
or