ASPXGridView生成Excel

    protected void Button1_Click(object sender, EventArgs e)
    {
        this.ASPxGridViewExporter1.GridViewID = "Grid1";
        ASPxGridViewExporter1.WriteXlsToResponse();
    }

<dx:ASPxGridViewExporter ID="ASPxGridViewExporter1" runat="server" 
        GridViewID="Grid1">
    </dx:ASPxGridViewExporter>

    <asp:Button ID="Button1" runat="server" onclick="Button1_Click" 
        Text="导出EXCEL" />

页面上拖入控件ASPxGridViewExporter,指定GridviewID为ASPxGridView的ID即可

 

你可能感兴趣的:(导出Excel,ASPxGridView)