0
您好我已经得到了使用Telerik的radgrid控件的一个DNN应用。我们从网格中导出一些数据,但是当我们深入网格控制并导出数据时,我们只能看到最初的顶层数据,而不是更新后的网格。这是我的表格标签和支持代码。我不是ASPX/C#的专家,所以请原谅我的新手。Telerik的radgrid控件似乎没有出口分组数据
<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经验和求生的意志:)
试试这个Telerik的论坛帖子对这个有点更多的信息:http://www.telerik.com/community/forums/aspnet-ajax/grid/radgrid-hierarchical-export-to-excel.aspx – SlackGadget 2011-01-06 12:53:35