We follow the steps here:
http://demos.telerik.com/aspnet-ajax/pivotgrid/examples/exporting/defaultcs.aspx
But the pivotgrid.exporttoexcel() is not working. We create a button to call this function but there is no file generated as shown in the demo.
Are we missing anything here?
We are using Telerik.Web.UI version 2013.3.1324.40
attach is the code.
http://demos.telerik.com/aspnet-ajax/pivotgrid/examples/exporting/defaultcs.aspx
But the pivotgrid.exporttoexcel() is not working. We create a button to call this function but there is no file generated as shown in the demo.
Are we missing anything here?
We are using Telerik.Web.UI version 2013.3.1324.40
attach is the code.
4 Answers, 1 is accepted
0
KE
Top achievements
Rank 1
answered on 25 Feb 2014, 11:27 AM
attach are the screenshot of the source code.
0
Matthias
Top achievements
Rank 1
answered on 26 Feb 2014, 03:40 PM
We experience the same problem. We do the ExportToExcel call and nothing happens.
Our code is also very similar to the demo linked above.
Our code is also very similar to the demo linked above.
0
Accepted
Hi guys,
The problem is most probably caused by the fact that the control triggering the export has been ajaxified.
For more information please see here:
Export from Ajaxified Grid
Approach 1 (Telerik RadAjaxManager/RadAjaxPanel dependent)
In this case you have to wire the handler like this:
or this:
Approach 2 - this will work with both the regular ASP.NET UpdatePanel and our AJAX controls:
Regards,
Daniel
Telerik
The problem is most probably caused by the fact that the control triggering the export has been ajaxified.
For more information please see here:
Export from Ajaxified Grid
Approach 1 (Telerik RadAjaxManager/RadAjaxPanel dependent)
function
onRequestStart(sender, args)
{
if
(args.get_eventTarget().indexOf(
"btnExport"
) >= 0)
args.set_enableAjax(
false
);
}
In this case you have to wire the handler like this:
<telerik:RadAjaxPanel ID="RadAjaxPanel1" runat="server" ClientEvents-OnRequestStart="onRequestStart" ...
or this:
<
telerik:RadAjaxManager
ID
=
"RadAjaxManager11"
runat
=
"server"
>
<ClientEvents OnRequestStart="onRequestStart" ...
Approach 2 - this will work with both the regular ASP.NET UpdatePanel and our AJAX controls:
<script type=
"text/javascript"
>
Sys.WebForms.PageRequestManager.getInstance().add_initializeRequest(initRequest);
function
initRequest(sender, args)
{
if
(args.get_postBackElement().id.indexOf(
"btnExport"
) != -1)
{
args.set_cancel(
true
);
//stop async request
sender._form[
"__EVENTTARGET"
].value = args.get_postBackElement().id.replace(/\_/g,
"$"
);
sender._form[
"__EVENTARGUMENT"
].value =
""
;
sender._form.submit();
return
;
}
}
</script>
Regards,
Daniel
Telerik
If you want to get updates on new releases, tips and tricks and sneak peeks at our product labs directly from the developers working on the UI for ASP.NET AJAX, subscribe to the blog feed now.
0
KE
Top achievements
Rank 1
answered on 28 Feb 2014, 04:19 AM
Hi Daniel,
It is resolved now, it was mistake on my side :), my javascript onrequeststart is implemented but I forget to add another indexof to look for the id:btnExport. It is already looking for ExportTo for RadGrid.
The javascript code should be like this any new btn that trigger export.
function onRequestStart(sender, args) {
if (args.get_eventTarget().indexOf("ExportTo") >= 0) {
args.set_enableAjax(false);
} else {
args.set_enableAjax(true);
}
if (args.get_eventTarget().indexOf("btnExport") >= 0) {
args.set_enableAjax(false);
} else {
args.set_enableAjax(true);
}
}
Hope this will help anyone.
Thanks
It is resolved now, it was mistake on my side :), my javascript onrequeststart is implemented but I forget to add another indexof to look for the id:btnExport. It is already looking for ExportTo for RadGrid.
The javascript code should be like this any new btn that trigger export.
function onRequestStart(sender, args) {
if (args.get_eventTarget().indexOf("ExportTo") >= 0) {
args.set_enableAjax(false);
} else {
args.set_enableAjax(true);
}
if (args.get_eventTarget().indexOf("btnExport") >= 0) {
args.set_enableAjax(false);
} else {
args.set_enableAjax(true);
}
}
Hope this will help anyone.
Thanks