I dont want to show ExpandCollapse button inside Excel. Please suggest how to overcome these problems.
Thanks
Venkat
13 Answers, 1 is accepted
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.
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">
</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
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.
ExportOnlyData property was set to true, still not working.
Thanks
Venkat
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.
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
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.
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();
}
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.
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
​
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.