Telerik RadGrid doesn't seem to export Grouped data
Posted
by
SlackGadget
on Stack Overflow
See other posts from Stack Overflow
or by SlackGadget
Published on 2011-01-05T12:43:48Z
Indexed on
2011/01/05
12:54 UTC
Read the original article
Hit count: 334
Hi I've got a DNN application using Telerik RadGrid. We're exporting some data from the Grid but when we drill down on the grid control and export the data we only see the initial top level data, never the updated Grid. Here's my table tag and supporting code. I'm not an expert in ASPX/C#so please forgive my newbie-ness.
<mastertableview autogeneratecolumns="False" datakeynames="AccountId" datasourceid="SqlDataSource1"
groupsdefaultexpanded="False">
<DetailTables>
<telerik:GridTableView runat="server" DataKeyNames="StatementId" DataSourceID="SqlDataSource2"
Font-Bold="False" Font-Italic="False" Font-Overline="False" Font-Strikeout="False"
Font-Underline="False" >
<DetailTables>
<telerik:GridTableView runat="server" DataSourceID="SqlDataSource3" Font-Bold="False"
Font-Italic="False" Font-Overline="False" Font-Strikeout="False" Font-Underline="False"
GroupsDefaultExpanded="False" ShowFooter="True" ShowGroupFooter="True" AllowMultiColumnSorting="True"
GridLines="None">
<ParentTableRelation>
<telerik:GridRelationFields DetailKeyField="StatementId" MasterKeyField="StatementId" />
</ParentTableRelation>
<AlternatingItemStyle BackColor="White" Font-Bold="False" Font-Italic="False" Font-Overline="False"
Font-Strikeout="False" Font-Underline="False" Wrap="True" />
<HeaderStyle Font-Bold="False" Font-Italic="False" Font-Overline="False" Font-Strikeout="False"
Font-Underline="False" Wrap="True" />
<FooterStyle BackColor="Yellow" Font-Bold="False" Font-Italic="False" Font-Overline="False"
Font-Strikeout="False" Font-Underline="False" Wrap="True" />
</telerik:GridTableView>
</DetailTables>
<ParentTableRelation>
<telerik:GridRelationFields DetailKeyField="AccountId" MasterKeyField="AccountId" />
</ParentTableRelation>
<CommandItemSettings ExportToPdfText="Export to Pdf" />
<ExpandCollapseColumn Visible="True">
</ExpandCollapseColumn>
</telerik:GridTableView>
</DetailTables>
<ParentTableRelation>
<telerik:GridRelationFields DetailKeyField="AccountId" MasterKeyField="AccountId" />
</ParentTableRelation>
<ExpandCollapseColumn Visible="True">
</ExpandCollapseColumn>
<Columns>
<telerik:GridBoundColumn DataField="ACCOUNTID" DataType="System.Int32" HeaderText="ACCOUNTID"
SortExpression="ACCOUNTID" UniqueName="ACCOUNTID">
</telerik:GridBoundColumn>
<telerik:GridBoundColumn DataField="ACCOUNTREF" HeaderText="ACCOUNTREF" SortExpression="ACCOUNTREF"
UniqueName="ACCOUNTREF">
</telerik:GridBoundColumn>
<telerik:GridBoundColumn DataField="CUSTOMERID" DataType="System.Int32" HeaderText="CUSTOMERID"
SortExpression="CUSTOMERID" UniqueName="CUSTOMERID">
</telerik:GridBoundColumn>
</Columns>
</mastertableview>
The exports are registered with the script manager on load :
protected void Page_Load(object sender, EventArgs e)
{
Button2.Enabled = Session[UserSelection.SelectedValue] != null ? true : false;
ScriptManager.GetCurrent(Page).RegisterPostBackControl(Button3);
ScriptManager.GetCurrent(Page).RegisterPostBackControl(Button4);
}
and I' calling the Export with the following :
protected void Button3_Click(object sender, System.EventArgs e)
{
//ConfigureExport();
RadGrid1.Rebind();
RadGrid1.ExportSettings.FileName = "RadGridExportToExcel";
RadGrid1.ExportSettings.ExportOnlyData = true;
RadGrid1.ExportSettings.OpenInNewWindow = true;
RadGrid1.MasterTableView.ExportToExcel();
}
Can anyone see what I'm missing, apart from DNN/ASPX experience and the will to live :)
© Stack Overflow or respective owner