当我们将gridview导出到excel时,只导出标题字段。如何导出内容呢? [英] When we export gridview to excel, only header field are exported. how to export content also?

查看:75
本文介绍了当我们将gridview导出到excel时,只导出标题字段。如何导出内容呢?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我们使用下面给出的代码。



<%@ Register assembly =ExportToExcelnamespace =KrishLabs.Web.Controlstagprefix =RK %>





we use the code given below.

<%@ Register assembly="ExportToExcel" namespace="KrishLabs.Web.Controls" tagprefix="RK" %>


<RK:ExportToExcel ID="ExportToExcel1"  runat="server" ApplyStyleInExcel="True"
                    Charset="utf-8" ContentEncoding="windows-1250" EnableHyperLinks="True" 
                    ExportFileName="FileName.xls" GridViewID="GridView1" IncludeTimeStamp="True" 
                    PageSize="All" Text="Export To Excel" Width="100px"/>

推荐答案

试试这个...... ...



Try this......

<RK:exporttoexcel id="ExportToExcel1" runat="server" applystyleinexcel="True" charset="utf-8" ContentEncoding="windows-1250" EnableHyperLinks="True" ExportFileName="Report.xls"

IncludeTimeStamp="True" PageSize="All" Text="Export To Excel"

PostBackUrl="Report.aspx" OnPreExport="submitButton_Click" />







设置你的PostBackUrl

在OnPreExport事件集中设置OnPreExport事件



GridView.DataSource和DataBind方法......



它有效....




set your PostBackUrl
set OnPreExport event

in OnPreExport event set GridView.DataSource and DataBind Method......

it works....


我建​​议你在这里发布并跟进你的问题:导出到Excel控件 [ ^ ]
I would suggest you to post and follow up your issue here: Export To Excel control[^]


这篇关于当我们将gridview导出到excel时,只导出标题字段。如何导出内容呢?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆