【问题标题】:ASPxGridView Master Detail Export to Excel - Detail Export not correctASPxGridView 主详细信息导出到 Excel - 详细信息导出不正确
【发布时间】:2021-07-05 12:03:00
【问题描述】:

我在 aspx 页面中有一个 aspxgridview,它的数据源让我的程序返回 2 个表。数据源自动生成详细信息网格,因为第二个表。但是当我得到 excel 导出详细信息网格时没有导出。

我的cs代码

protected void Page_Load(object sender, EventArgs e)
{
     ASPxGridView1.DataSource = mydatatable;
     ASPxGridView1.DataBind();
}
protected void btnGridToExcell_Click(object sender, EventArgs e)
{

    ASPxGridView1.SettingsDetail.ExportMode = DevExpress.Web.GridViewDetailExportMode.All;
    ASPxGridViewExporter1.WriteXlsxToResponse(new XlsxExportOptionsEx() { ExportType = ExportType.WYSIWYG });
}

aspx 代码

<dx:ASPxGridView ID="ASPxGridView1" runat="server" ClientInstanceName="ASPxGridView1" OnCustomCallback="ASPxGridView1_CustomCallback" >
            <SettingsDetail ShowDetailRow="true" />
</dx:ASPxGridView>

【问题讨论】:

    标签: asp.net devexpress aspxgridview


    【解决方案1】:

    确保将主 ASPxGridView.SettingsDetail.ExportMode 设置为 Expanded/All 并使用实际/相关/过滤的数据填充详细信息网格:

    <dx:ASPxGridView ID="ASPxGridView1" runat="server" ...>
        <SettingsDetail ShowDetailRow="true" ExportMode="All" />
    </dx:ASPxGridView>
    

    查看this 演示以了解此功能/方法的实际应用。

    【讨论】:

    • 我的问题我不能使用 OnBeforePerformDataSelect 事件,因为我的细节网格是从存储过程生成的
    猜你喜欢
    • 1970-01-01
    • 2020-09-04
    • 1970-01-01
    • 1970-01-01
    • 2018-09-06
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    • 2010-12-06
    相关资源
    最近更新 更多