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

Add RadGrid to RadPanelItem Dynamically via c#

1 Answer 104 Views
PanelBar
This is a migrated thread and some comments may be shown as answers.
Robert
Top achievements
Rank 1
Robert asked on 03 May 2011, 08:22 PM
I am creating a RadGrid dynamically based on data that comes through.  The number of grids can vary.  What I want to do is allow for the collapsing of these grids.  For example, if 10 grids are created, the length is unwieldy and I would like to collapse all but the first, and have the user be able to expand them on click.  I have looked around and do not see a solution within the grid itself.  I would like to keep the header row as the column names, and use something above it sort of detailing the grid like "Number of Customers: #".

My theoretical solution was to use a RadPanelBar, inserting the grid into a RadPanelItem, and then into the PanelBar.  Looking at the demo of the calendar shows:

<telerik:RadPanelBar  runat="server" ID="RadPanelBar1" Height="380px" ExpandMode="FullExpandedItem">
            <Items>
                <telerik:RadPanelItem Text="Calendar" ImageUrl="Img/calendar.gif">
                    <Items>
                        <telerik:RadPanelItem>
                            <ItemTemplate>
                                <telerik:RadCalendar runat="server" ID="Calendar1" Style="margin: 6px auto 0" />
                            </ItemTemplate>
                        </telerik:RadPanelItem>
                    </Items>
                </telerik:RadPanelItem>
             </Items>
</telerik:RadPanelBar>

However, I am required to create this from the codebehind.  I've gone through quite a few iterations and can't seem to find the syntax.  I am guessing it has to do with ItemTemplate.InstantiateIn(grid), but do I have to extend the ITemplate or something?

1 Answer, 1 is accepted

Sort by
0
Dimitar Terziev
Telerik team
answered on 09 May 2011, 03:03 PM
Hello Robert,

On how to add templates dynamically from code behind, please refer to the following help article.

Best wishes,
Dimitar Terziev
the Telerik team

Browse the vast support resources we have to jump start your development with RadControls for ASP.NET AJAX. See how to integrate our AJAX controls seamlessly in SharePoint 2007/2010 visiting our common SharePoint portal.

Tags
PanelBar
Asked by
Robert
Top achievements
Rank 1
Answers by
Dimitar Terziev
Telerik team
Share this question
or