vb.net 当我单击将 RadGrid 导出到 Excel 的按钮时没有任何反应
声明:本页面是StackOverFlow热门问题的中英对照翻译,遵循CC BY-SA 4.0协议,如果您需要使用它,必须同样遵循CC BY-SA许可,注明原文地址和作者信息,同时你必须将它归于原作者(不是我):StackOverFlow
原文地址: http://stackoverflow.com/questions/24455661/
Warning: these are provided under cc-by-sa 4.0 license. You are free to use/share it, But you must attribute it to the original authors (not me):
StackOverFlow
Nothing happens when I click the button for RadGrid export to Excel
提问by user3749447
I have a simple grid I'm trying to export to excel however when I click on the excel button in the command item display, nothing happens. Is this not automated or do I need vb behind it to tell it to actually export?
我有一个简单的网格,我试图导出到 excel,但是当我单击命令项显示中的 excel 按钮时,没有任何反应。这不是自动化的还是我需要背后的 vb 告诉它实际导出?
radgrid:
雷达网格:
<telerik:RadGrid ID="Grid_Curric1" runat="server" DataSourceID="SqlCurric1" Width="700px" Skin="WebBlue" CellSpacing="0" GridLines="None" >
<ExportSettings>
<Excel Format="ExcelML" />
</ExportSettings>
<MasterTableView AutoGenerateColumns="False" DataSourceID="SqlCurric1" Font-Size="Medium" CommandItemDisplay="Top">
<CommandItemSettings ShowExportToExcelButton="True" />
<Columns>
<telerik:GridBoundColumn DataField="Growth" HeaderText="Growth" SortExpression="Growth" UniqueName="Growth">
</telerik:GridBoundColumn>
<telerik:GridBoundColumn DataField="Efficiency" HeaderText="Efficiency" SortExpression="Efficiency" UniqueName="Efficiency">
</telerik:GridBoundColumn>
<telerik:GridBoundColumn DataField="Risk" HeaderText="Risk" SortExpression="Risk" UniqueName="Risk">
</telerik:GridBoundColumn>
</Columns>
</MasterTableView>
</telerik:RadGrid>
回答by rdmptn
My best guess is that you have AJAX enabled the grid, so it cannot send the file. Take a look here to see if this is the case and how to fix it: http://www.telerik.com/help/aspnet-ajax/grid-export-with-ajax-enabled.html
我最好的猜测是您在网格中启用了 AJAX,因此它无法发送文件。看看这里是否是这种情况以及如何解决它:http: //www.telerik.com/help/aspnet-ajax/grid-export-with-ajax-enabled.html
回答by FeliceM
You do not need code behind to use the embedded export feature of the radgrid. Try to add the page settings and may be also the pdf to check if it works with pdf:
您不需要背后的代码来使用 radgrid 的嵌入式导出功能。尝试添加页面设置,也可能是 pdf 以检查它是否适用于 pdf:
<ExportSettings ExportOnlyData="True" IgnorePaging="True">
<Pdf PageWidth="210mm" PageHeight="297mm" PaperSize="A4"></Pdf>
<Excel Format="ExcelML" />
</ExportSettings>
If the above does not work, most probably your grid is inside an Ajax panel and this cause you export features not working. You should read this.
如果上述方法不起作用,很可能您的网格位于 Ajax 面板内,这会导致您导出的功能不起作用。你应该阅读这个。
回答by Rumen Jekov
Check this super fresh blog on the topic: http://blogs.telerik.com/blogs/14-06-27/new-export-and-import-capabilities-for-asp-net-ajax-suite. It includes code samples that you can try.
检查这个关于这个主题的超级新鲜博客:http: //blogs.telerik.com/blogs/14-06-27/new-export-and-import-capabilities-for-asp-net-ajax-suite。它包括您可以尝试的代码示例。

