I have placed a Grid inside WARP (WebAsyncRefreshPanel1), the following export to excel code is not working Protected Sub lnkExport_Click(ByVal sender As Object, ByVal e As System.EventArgs) Handles lnkExport.Click LoadData() 'UltraWebGridExcelExporter1.DownloadName = "test.xls" UltraWebGridExcelExporter1.Export(ultrawebgrid1) End Sub If I dont use WARP the functionality of export to excel is working fine. Can anybody help on this?
I believe there are issues when trying to do file transfers to or from the server when using AJAX. You will want to place the button that starts the export/download of the excel file outside of the WARP or if you need to have the button inside of the WARP, add the button's client id to the TriggerPostBackIDs property.
https://es.infragistics.com/help/aspnet/webexcelexporter-using-webexcelexporter
(Using v8.2)
So, at this moment is impossible to make an Excel export of a webgrid which is inside a WARP?
Thanks a lot.
In my project I had the button that starts the exporting outside the WARP, but it still generated empty excel files. So I decided not to use WARP.
I found that I was rebinding the webgrid after the "Export to Excel" button was pressed. I prevented that from happening again and I was able to Export to Excel again, even when the webgrid was insider a WARP.
Thanks.
Hi
I am using Gridview in a WARP control. My GridView Contains link buttons as Template Control. By clicking that LinkButton I have to Download some file from server. When i Try above mentioned menthod and changing WARP control's TriggerdPostnackIDs ... its not allowing to download file. Please help me with this. I appreciate your help with this. Thank you.
Hello,
The technique suggested above works for buttons that are _outside_ the grid (but still inside the WARP). It will be very tough to do that for buttons inside the template, since the IDs there are autogenerated and it is very tough to hook them to the TriggeredPostBackIDs collection of WARP.
You can however use some javascript trickery to make it work. Just use OnClickClick instead of server-side events for your linkbuttons and use javascript to force click on a button outside grid and warp that will initiate the actual export
Example:
<CellTemplate>
<asp:LinkButton OnClientClick="exportToExcel()"
</CellTemplate>
// this button will be outside grid and warp - or could be inside WARP but needs to be excluded via TriggeredPostBackId
<asp:button ID="ExportToExcel" ... />
<script type=" text/javascript">
function exportToExcel()
{
document.getElementById("<%= ExportToExcel.ClientID %>").click();
}
</script>
HTH,
Hello Manoj,
Thanks for sharing this in public forums. This has turned into a great thread on exporting grids into Excel in WARP, I am sure many people will appreciate that.