Telerik RadGrid 似乎无法导出分组数据
您好,我有一个使用 Telerik RadGrid 的 DNN 应用程序。我们正在从网格导出一些数据,但是当我们深入网格控件并导出数据时,我们只能看到初始的顶级数据,而看不到更新的网格。这是我的表标签和支持代码。我不是 ASPX/C# 方面的专家,所以请原谅我的新手。
<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>
导出在加载时向脚本管理器注册:
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);
}
并且我使用以下内容调用导出:
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();
}
除了 DNN/ASPX 经验和生存意愿之外,任何人都可以看到我缺少的内容吗:)
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 :)
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。
绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(1)
已解决:但不完全...通过将以下内容添加
到button_click事件中,例如:
虽然这只是给出了第一级分组,但没有子组。此外,它不仅导出您选择的向下钻取数据,还只是将整个网格的扩展视图扩展到第一级...最后,要使第三级详细信息表正常工作,您可以添加
这对我来说在 DNN 中引发了 OOM 错误:
我猜您必须进行某种事件处理并在模式窗口中手动打开数据并将其导出。
Solved: but not completely... By adding the following
to the button_click event eg:
Although this just gives the first level grouping, no sub groups. Also it doesn't just export the drill down data you selected but just an expanded view of the entire grid to the first level... Finally, to get the tertiary detail table working you can add
This threw an OOM error in DNN for me :
I'm guessing you'd have to do some sort of event processing and manually open the data in a modal window and export that instead.