ASP.Net导出到没有Gridview的Excel [英] ASP.Net Export To Excel Without Gridview
本文介绍了ASP.Net导出到没有Gridview的Excel的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!
问题描述
我有一个包含205列的Asp.Net GridView。
我可以使用另存为提示将其导出到Excel。导出到excel工作正常。
我的问题是我可以在主页上创建一个简单的LinkButton,上面写着'导出到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 theDataTable
directly. ExportDataTable
to Excel. There is no need to bind theGridView
.
这篇关于ASP.Net导出到没有Gridview的Excel的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!
查看全文