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

GridBoundColumn Forgetting Header

1 Answer 28 Views
Grid
This is a migrated thread and some comments may be shown as answers.
Andrew
Top achievements
Rank 1
Andrew asked on 08 Oct 2012, 10:11 PM
Hello Telerik Community!

I'm encountering a situation where the header text becomes blank for all columns within a RadGrid NestedViewTemplate after expanding a sibling NestedViewTemplate row.  Here's the breakdown (you might need to draw this one out):

RadGrid1 contains it's own columns along with a NestedViewTemplate.  We'll call this column "Summary.NVT".  Within "Summary.NVT" is RadGrid2 with it's own unique columns.  We'll call this child grid, "Details".  The "Details" table is dynamically generated upon callback "Summary_ItemCreated".  When "Summary.NVT" is expanded for row 0, the "Details" grid and all of it's columns are properly displayed.  When "Summary.NVT" is then expanded for row 1, "Details row 0" retained it's rows but without column header text and "Details row 1" is now properly displayed with column header text.

Following me?  Tricky to explain.  There is one variable which changes the above behavior.  For the "Details" grid, if I specify "AutoGenerateColumns" as true, my column headers will work all the time.  This is great aside from losing formatting capabilities.  I would prefer to add dynamically created columns via "GridBoundColumn" objects.  

The reason for the dynamically generated nested details grid is to display different detail columns for each expanded summary record.  Some summaries will have different detail columns than others.

Any advice on retaining my column header text when expanding multiple rows containing dynamically generated grids?

1 Answer, 1 is accepted

Sort by
0
Antonio Stoilkov
Telerik team
answered on 11 Oct 2012, 11:59 AM
Hello Andrew,

Based on your description it is hard to determine the problem. However, you could achieve your scenario by using the AutoGenerateColumns to true and subscribing to RadGrid ColumnCreated event where you could set all desired properties in order to format the column as needed. Note that when creating RadGrid dynamically you should do it either on Page_Load or Page_Init as described in the help article below.

Kind regards,
Antonio Stoilkov
the Telerik team
If you want to get updates on new releases, tips and tricks and sneak peeks at our product labs directly from the developers working on the RadControls for ASP.NET AJAX, subscribe to their blog feed now.
Tags
Grid
Asked by
Andrew
Top achievements
Rank 1
Answers by
Antonio Stoilkov
Telerik team
Share this question
or