4 Answers, 1 is accepted
Try the following code to achieve your scenario.
VB:
Protected
Sub
RadGrid1_ItemCommand(sender
As
Object
, e
As
GridCommandEventArgs)
If
e.CommandName = RadGrid.ExportToPdfCommandName
Then
RadGrid1.MasterTableView.HierarchyDefaultExpanded =
True
RadGrid1.MasterTableView.DetailTables(0).HierarchyDefaultExpanded =
True
End
If
If
e.CommandName = RadGrid.ExportToExcelCommandName
Then
RadGrid1.MasterTableView.HierarchyDefaultExpanded =
True
RadGrid1.MasterTableView.DetailTables(0).HierarchyDefaultExpanded =
True
End
If
End
Sub
Thanks,
Princy.
I have defined export settings as below
<ExportSettings FileName="Question-Paper-IL" HideStructureColumns="true" ExportOnlyData="true" IgnorePaging="true" OpenInNewWindow="true">
<Excel Format="ExcelML" />
<Pdf DefaultFontFamily="Tahoma" Producer="Question-Paper-IL" PageTitle="Question Paper IL Report" FontType="Subset" />
</
ExportSettings>
It throws the following error
Object reference not set to an instance of an object.
Description: An unhandled exception occurred during the execution of the current web request. Please review the stack trace for more information about the error and where it originated in the code.
If i remove the above code then excel export works but it also exports the controls.
Help me
RadGrid1.MasterTableView.DetailTables(0).HierarchyDefaultExpanded =
True
The above line throws the below error.
Object reference not set to an instance of an object.
Description: An unhandled exception occurred during the execution of the current web request. Please review the stack trace for more information about the error and where it originated in the code.
If i remove that code, master table and detail table data are exporting in PDF with detail table Command Item link buttons. How to control exporting the controls?
I am calling .ascx in detail table while clicking 'Add New' command item link button. While cancel it collapse the detail and master table which i dont want. So i used the below code:
rgView1.MasterTableView.DetailTables(0).HierarchyDefaultExpanded =
True
It doesnt collapse the detail table, but .ascx page still exists, i need only the detail table rows. How to achieve it?
I have attached the image file with this.
Its urgent.
Guide me
You can borrow some ideas from the attached sample.
Let us know if you need more information.
Regards,
Daniel
the Telerik team