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

Export Grid / Hierarchy with Templates

1 Answer 106 Views
Grid
This is a migrated thread and some comments may be shown as answers.
Gary
Top achievements
Rank 1
Gary asked on 14 Dec 2010, 12:18 AM
Hi all,

I was wondering is it possible to export the RadGrid to Excel like the one in this demo (http://demos.telerik.com/aspnet-ajax/grid/examples/hierarchy/nestedviewtemplate/defaultvb.aspx). (See 1.png and 2.png attachments)

At the moment, my page replicates the demo pretty closely. Unlike the demo, the three RadTabs all contains a RadGrid with relations to the main RadGrid. I want to be able to export each of these RadGrids independently. Each RadPageView will contain a button and a RadGrid. The button will export the RadGrid in that RadPageView only.

My problem right now is I cannot address the button or RadGrid inside the NestedViewTemplate from code behind. Could this be done?

Thanks,
Gary

1 Answer, 1 is accepted

Sort by
0
Daniel
Telerik team
answered on 17 Dec 2010, 01:17 AM
Hello Gary,

Please try the following approach:
<telerik:RadPageView runat="server" ID="PageView1">
     <asp:Button ID="Button1" runat="server" Text="Export" ...
     <telerik:RadGrid runat="server" ...

protected void Button1_Click(object sender, EventArgs e)
{
    RadGrid radGrid = (sender as Button).Parent.FindControl("RadGrid1") as RadGrid;
    radGrid.MasterTableView.ExportToExcel();

Let me know whether this code is suitable for your scenario.

Best regards,
Daniel
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
Grid
Asked by
Gary
Top achievements
Rank 1
Answers by
Daniel
Telerik team
Share this question
or