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

Hierarchical Grid Excel Export

13 Answers 216 Views
General Discussions
This is a migrated thread and some comments may be shown as answers.
ESM Dev
Top achievements
Rank 1
ESM Dev asked on 03 Jul 2009, 06:25 PM
I am working on hierarchical grid where I am having 1 details tables each one resides inside other. It is like drilldown feature. My next task is to export complete data on the grid to Excel.

I dont want to show ExpandCollapse button inside Excel. Please suggest how to overcome these problems.

Thanks
Venkat

13 Answers, 1 is accepted

Sort by
0
Pavlina
Telerik team
answered on 06 Jul 2009, 07:57 AM
Hi,

Attached to this message is a simple runnable application that demonstrates the needed approach. Please give it a try and see if it works for you or if I am leaving something out.

Best wishes,
Pavlina
the Telerik team

Instantly find answers to your questions on the new Telerik Support Portal.
Check out the tips for optimizing your support resource searches.
0
ESM Dev
Top achievements
Rank 1
answered on 07 Jul 2009, 12:17 PM
Hi,

Tried with the given attachment, but still not dropping the expand/collapse column. Have a look at RadGrid am using.

 

<telerik:RadGrid ID="RadGridParent" runat="server" Width="100%" AutoGenerateColumns="False" AllowSorting="True" AllowPaging="True" PageSize="5" GridLines="None" OnNeedDataSource="RadGridParent_NeedDataSource" OnItemCommand="RadGridParent_ItemCommand" Visible="False">      

<MasterTableView DataKeyNames="I3_Rowid" AllowMultiColumnSorting="True">
<NestedViewTemplate>
<asp:Panel runat="server" ID="InnerContainer" CssClass="viewWrap" Visible="false">
<asp:Button ID="btnExpChildData" Text="Export to Excel" SkinID="Button" runat="server" Visible="false" OnClick="Export_Click" CommandName="Child" /> <br /> <br />
<telerik:RadGrid ID="RadGridChild" runat="server" Width="100%" GridLines="None" PageSize="5" AllowPaging="True" OnNeedDataSource="RadGridChild_NeedDataSource" ShowStatusBar="True" AllowSorting="True">  

</telerik:RadGrid>
</asp:Panel>
</NestedViewTemplate>
<Columns> <telerik:GridBoundColumn SortExpression="I3_RowID" HeaderText="I3_RowID" HeaderButtonType="TextButton"  

DataField="I3_RowID" UniqueName="I3_RowID"> </telerik:GridBoundColumn>
<telerik:GridBoundColumn SortExpression="ESM_Client_I3_RowID" HeaderText="ESM_Client_I3_RowID" HeaderButtonType="TextButton" DataField="ESM_Client_I3_RowID" UniqueName="ESM_Client_I3_RowID"> </telerik:GridBoundColumn>
<telerik:GridBoundColumn SortExpression="CampaignID" HeaderText="CampaignID" HeaderButtonType="TextButton" DataField="CampaignID" UniqueName="CampaignID">
</telerik:GridBoundColumn>
<telerik:GridBoundColumn SortExpression="CampaignName" HeaderText="CampaignName" HeaderButtonType="TextButton" DataField="CampaignName" UniqueName="CampaignName">
</telerik:GridBoundColumn>
<telerik:GridBoundColumn SortExpression="ScriptID" HeaderText="ScriptID" HeaderButtonType="TextButton"   DataField="ScriptID" UniqueName="ScriptID">   </telerik:GridBoundColumn   <telerik:GridBoundColumn SortExpression="ScriptName" HeaderText="ScriptName" HeaderButtonType="TextButton"   DataField="ScriptName" UniqueName="ScriptName"> </telerik:GridBoundColumn   <telerik:GridBoundColumn SortExpression="LeadInquiryDate" DataFormatString="{0:MM/dd/yyyy}" HeaderButtonType="TextButton" HeaderText="LeadInquiryDate" DataField="LeadInquiryDate" UniqueName="LeadInquiryDate">    </telerik:GridBoundColumn   <telerik:GridBoundColumn SortExpression="FirstName" HeaderText="FirstName" HeaderButtonType="TextButton"   DataField="FirstName" UniqueName="FirstName">    </telerik:GridBoundColumn   

<telerik:GridBoundColumn SortExpression="LastName" HeaderText="LastName" HeaderButtonType="TextButton"   DataField="LastName" UniqueName="LastName">  </telerik:GridBoundColumn
<telerik:GridBoundColumn SortExpression="DateAdded" DataFormatString="{0:MM/dd/yyyy}" HeaderButtonType="TextButton" HeaderText="DateAdded" DataField="DateAdded" UniqueName="DateAdded">   </telerik:GridBoundColumn 
<telerik:GridBoundColumn SortExpression="Status" HeaderText="Status" HeaderButtonType="TextButton" DataField="Status" UniqueName="Status">    </telerik:GridBoundColumn   
</Columns   
<ExpandCollapseColumn Visible="True">  
</ExpandCollapseColumn 
</MasterTableView 
<ExportSettings ExportOnlyData="True" IgnorePaging="True" OpenInNewWindow="True">  
</ExportSettings> 
</telerik:RadGrid>

 

Thanks
Venkat

0
Pavlina
Telerik team
answered on 07 Jul 2009, 02:39 PM
Hello,

In case you do not want to show ExpandCollapse button inside Excel, please set ExportOnlyData property, which determines whether only data will be exported, to true and let me know if it helps.
For more information about Exporting, please refer to the following articles:
Help topic
Demo

Kind regards,
Pavlina
the Telerik team

Instantly find answers to your questions on the new Telerik Support Portal.
Check out the tips for optimizing your support resource searches.
0
ESM Dev
Top achievements
Rank 1
answered on 08 Jul 2009, 11:27 AM
Hi,

ExportOnlyData  property was set to true, still not working.

Thanks
Venkat
0
Pavlina
Telerik team
answered on 08 Jul 2009, 01:26 PM
Hello,

At this point in order to progress in the resolution of this matter I will ask you to open a formal support ticket and send us a simple running project (incl. CSS, images, skins, DB backup if needed and so on) demonstrating the problem. In that way we can reproduce and pinpoint the problems you're facing on our side, understand the logic of your application and provide a solution.

Regards,
Pavlina
the Telerik team

Instantly find answers to your questions on the new Telerik Support Portal.
Check out the tips for optimizing your support resource searches.
0
Joseph
Top achievements
Rank 1
answered on 07 Jul 2014, 06:02 PM
Has this been resolved.  I too have a Detailed Report within a MasterTableView that is not expanded when i export to Excel.  Please advice.
0
Princy
Top achievements
Rank 2
answered on 08 Jul 2014, 09:48 AM
Hi Joseph,

Please try the below code snippet on ItemCommand event on export to expand hierarchical grid.

C#:
protected void RadGrid1_ItemCommand(object sender, GridCommandEventArgs e)
{
  if (e.CommandName == RadGrid.ExportToExcelCommandName)
  {
   RadGrid1.MasterTableView.HierarchyDefaultExpanded = true;
   RadGrid1.MasterTableView.DetailTables[0].HierarchyDefaultExpanded = true;
   RadGrid1.MasterTableView.HierarchyLoadMode = GridChildLoadMode.Client;
   RadGrid1.MasterTableView.DetailTables[0].HierarchyLoadMode = GridChildLoadMode.Client;      
   RadGrid1.AllowPaging = false;
   RadGrid1.MasterTableView.DetailTables[0].AllowPaging = false;
   RadGrid1.Rebind();
  }
}

Thanks,
Princy
0
Joseph
Top achievements
Rank 1
answered on 09 Jul 2014, 10:20 PM
I've tried this and it worked, but what if I have a 3rd Hierarcy DetailTable?  i've tried doing RadGrid1.MasterTableView.DetailTables(0).DetailTables(0).HierarchyDefaultExpanded = True but that didn't work.  Please advice.
0
Pavlina
Telerik team
answered on 10 Jul 2014, 04:04 PM
Hello Joseph,

You can try with the following code:
RadGrid1.MasterTableView.HierarchyDefaultExpanded = true;
   
 if (RadGrid1.MasterTableView.HasDetailTables)
 {
   foreach (GridTableView gridTableView in   RadGrid1.MasterTableView.DetailTables)
   {
       gridTableView.HierarchyDefaultExpanded = true;
   }
 }
RadGrid1.Rebind();

Regards,
Pavlina
Telerik
 

Check out the Telerik Platform - the only platform that combines a rich set of UI tools with powerful cloud services to develop web, hybrid and native mobile apps.

 
0
SABITHA
Top achievements
Rank 1
answered on 29 Jan 2015, 08:28 AM
Hi all,
I'm having issues in the expand collpase column of the telerik hierrarchy grid . I'm using a link button where it is calling the export to excel () function. Code snippet is as shown below.

private void lnkExport_Click(object sender, System.EventArgs e)
{    
foreach (GridDataItem mItem in uwgTermSheets.MasterTableView.Items)
{
mItem.Expanded = true;
foreach (GridDataItem childItem in mItem.ChildItem.NestedTableViews[0].Items)
{
childItem.Expanded = true;
}
}
 
uwgTermSheets.MasterTableView.ExpandCollapseColumn.Exportable = true;
uwgTermSheets.MasterTableView.ExportToExcel();
uwgTermSheets.Rebind();
}
0
Pavlina
Telerik team
answered on 02 Feb 2015, 10:56 PM
Hi,

Could you elaborate a bit more on your scenario? What are the exact issues you encounter with the expand collapse column of hierarchy grid? Providing the complete aspx code and the related code behind would help us a lot to understand your scenario better and advice you further.

Regards,
Pavlina
Telerik
 

Check out the Telerik Platform - the only platform that combines a rich set of UI tools with powerful cloud services to develop web, hybrid and native mobile apps.

 
0
SABITHA
Top achievements
Rank 1
answered on 03 Feb 2015, 06:38 AM
Hi,

I'm attaching the sample code for exporting to the excel from the telerik hierarchical grid,  where I cannot expand and collapse the detailed columns. Please have a look into the attached code. If there is any problem in downloading the files  see the code below for the excel exporting.


protected void Button1_Click(object sender, EventArgs e)
{
RadGrid1.ExportSettings.FileName = "filename";
RadGrid1.ExportSettings.IgnorePaging = true;
RadGrid1.ExportSettings.ExportOnlyData = true;
RadGrid1.ExportSettings.OpenInNewWindow = true;
RadGrid1.MasterTableView.UseAllDataFields = true;
RadGrid1.ExportSettings.Excel.Format = GridExcelExportFormat.ExcelML;
RadGrid1.MasterTableView.HierarchyDefaultExpanded = true;
RadGrid1.MasterTableView.DetailTables[0].HierarchyDefaultExpanded = true;
RadGrid1.MasterTableView.HierarchyLoadMode = GridChildLoadMode.Client;
RadGrid1.MasterTableView.DetailTables[0].HierarchyLoadMode = GridChildLoadMode.Client;
RadGrid1.MasterTableView.EnableGroupsExpandAll = true;
RadGrid1.MasterTableView.ExportToExcel();
}

Thanks ,
Sabitha
​
0
Pavlina
Telerik team
answered on 05 Feb 2015, 01:43 PM
Hi Sabitha,

I noticed that my colleague Kostadin has already answered on this question in the other forum thread you have opened: 

In order to avoid duplicate posts I will ask you to continue your communication there.

Regards,
Pavlina
Telerik
 

Check out the Telerik Platform - the only platform that combines a rich set of UI tools with powerful cloud services to develop web, hybrid and native mobile apps.

 
Tags
General Discussions
Asked by
ESM Dev
Top achievements
Rank 1
Answers by
Pavlina
Telerik team
ESM Dev
Top achievements
Rank 1
Joseph
Top achievements
Rank 1
Princy
Top achievements
Rank 2
SABITHA
Top achievements
Rank 1
Share this question
or