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

Don't export Nested View Template

3 Answers 91 Views
Grid
This is a migrated thread and some comments may be shown as answers.
Shawn
Top achievements
Rank 1
Shawn asked on 30 Oct 2015, 03:28 PM

I have a RadGrid that contains a NestedView Template.   With the export option, i DO NOT want the NestedView to export (even if the nested view is visible).

 

While the grid item isn't expanded, i don't see the NestedView data.  However, when one is expanded, it will export.  How do I keep that from happening?

3 Answers, 1 is accepted

Sort by
0
Eyup
Telerik team
answered on 03 Nov 2015, 07:34 AM
Hi Shawn,

If you are using the IgnorePaging export option, you can use the following logic to achieve this requirement:
protected void RadGrid1_ItemCommand(object source, GridCommandEventArgs e)
{
    if (e.CommandName == RadGrid.ExportToExcelCommandName)
    {
        RadGrid1.MasterTableView.HierarchyDefaultExpanded = false;
    }
}

Hope this helps. Please give it a try and let me know if it works for you.

Regards,
Eyup
Telerik
Do you want to have your say when we set our development plans? Do you want to know when a feature you care about is added or when a bug fixed? Explore the Telerik Feedback Portal and vote to affect the priority of the items
0
Shawn
Top achievements
Rank 1
answered on 03 Nov 2015, 02:06 PM

Thanks for responding.   Unfortunately, that did not seem to help.  I noticed that value is already set to false before I edit it.   I even tried this: 

grid.MasterTableView.GroupsDefaultExpanded = false;

That didn't help either.

0
Kostadin
Telerik team
answered on 06 Nov 2015, 08:09 AM
Hello Shawn,

Which export format you are using? Keep in mind that you need either to rebind the grid or enable IgnorePaging in order to collapse the detail tables. Another possible solution is to hide the NestedViewTemplate when you export the grid. Please check out the following help article.
protected void RadGrid1_ItemCreated(object sender, GridItemEventArgs e)
{
    if (e.Item is GridNestedViewItem && RadGrid1.IsExporting)
    {
        e.Item.Visible = false;
    }
}

Similarly You should rebind the grid or enable IgnorePaging.

Regards,
Kostadin
Telerik
Do you want to have your say when we set our development plans? Do you want to know when a feature you care about is added or when a bug fixed? Explore the Telerik Feedback Portal and vote to affect the priority of the items
Tags
Grid
Asked by
Shawn
Top achievements
Rank 1
Answers by
Eyup
Telerik team
Shawn
Top achievements
Rank 1
Kostadin
Telerik team
Share this question
or