ASP.Net导出到没有Gridview的Excel [英] ASP.Net Export To Excel Without Gridview

查看:73
本文介绍了ASP.Net导出到没有Gridview的Excel的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我有一个包含205列的Asp.Net GridView。



我可以使用另存为提示将其导出到Excel。导出到excel工作正常。



我的问题是我可以在主页上创建一个简单的LinkBut​​ton,上面写着'导出到Excel'而不显示整个GridView某个页面?

I have an Asp.Net GridView that contains 205 columns.

I can export it to an Excel with the save as prompt. The export to excel is working properly.

My question here is can I create a simple LinkButton on the home page that says 'Export to Excel' without showing the entire GridView on a certain page?

推荐答案

是的,为什么不呢。



只需使用 DataTable 直接。将 DataTable 导出到Excel。无需绑定 GridView
Yes, why not.

Just use the DataTable directly. Export DataTable to Excel. There is no need to bind the GridView.


这篇关于ASP.Net导出到没有Gridview的Excel的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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