This is a migrated thread and some comments may be shown as answers.

RadGrid - Cancel Export after GridExporting event

10 Answers 143 Views
Grid
This is a migrated thread and some comments may be shown as answers.
Jason
Top achievements
Rank 1
Jason asked on 12 Mar 2009, 04:21 PM
Hello,

I was wondering if it is possible to cancel the RadGrid's Export after the GridExporting event. 

I have figured out that I can save a file to the server during the GridExporting event, and after this occurs, I would like to cancel the rest of the normal process.

Any ideas?

Thanks in advance!

Jason

10 Answers, 1 is accepted

Sort by
0
Daniel
Telerik team
answered on 12 Mar 2009, 05:23 PM
Hello Jason,

I believe you can redirect to the same page to achieve the desired effect:
Response.Redirect(Request.Url.ToString()); 

Kind regards,
Daniel
the Telerik team

Instantly find answers to your questions on the new Telerik Support Portal.
Check out the tips for optimizing your support resource searches.
0
Paul
Top achievements
Rank 1
answered on 04 Jun 2009, 06:28 PM
The solution doesn't really cancel, it just reloads the page.  Is there a way to cancel the export (set the file to null or clear the response)? Basically I want to cancel the process and continue with the postback.
0
Daniel
Telerik team
answered on 08 Jun 2009, 08:42 AM
Hello Paul,

Straight onto the answers:

The solution doesn't really cancel, it just reloads the page.

Yes, this is the actual result of my suggestion.

Is there a way to cancel the export (set the file to null or clear the response)?

No. In the best case you will face a blank page.

Basically I want to cancel the process and continue with the postback.

At this point (where you want to cancel the event) the server is in a process of generating the response to the client. Therefore (as I mentioned before) if you cancel it you will end up with an empty page because the output will be displayed on the screen instead of file stream.

Best regards,
Daniel
the Telerik team

Instantly find answers to your questions on the new Telerik Support Portal.
Check out the tips for optimizing your support resource searches.
0
Meenakshi
Top achievements
Rank 1
answered on 29 May 2012, 10:39 AM
Hello Daniel,

Is there any workaround for this pbm. I too want to do the same thing. In my GridExporting method, i am trying to open the outlook with the exported excel file as an attachment and i would like the user to stay on the same page without reloading.

Please let me know is there any workaround for this pbm.

Regards,
Meenakshi Sekar.
0
Daniel
Telerik team
answered on 31 May 2012, 11:41 AM
Hi Meenakshi,

GridExporting event fires too late in the page lifecycle that's why you can't just "cancel" the export.

Regards,
Daniel
the Telerik team
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 RadControls for ASP.NET AJAX, subscribe to their blog feed now.
0
Meenakshi
Top achievements
Rank 1
answered on 02 Jun 2012, 06:10 AM
Thanks Daniel. 

Regards,
Meenakshi Sekar. 
0
Sunny
Top achievements
Rank 1
answered on 13 May 2013, 01:20 AM
I would like to get the XML of radgrid which has been generated in Grid Exporting event
e.ExportOutput

so that i can merge it with another Grid and then export manually to on Excel document with two sheets showing two different RadGrids data in ML format.


Regards,
0
Daniel
Telerik team
answered on 14 May 2013, 08:51 AM
Hello Sana,

Yes, this is possible although not very straightforward. You can get the generated XMLSS code in the GridExporting event.

Best regards,
Daniel
the Telerik team
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 RadControls for ASP.NET AJAX, subscribe to their blog feed now.
0
Sunny
Top achievements
Rank 1
answered on 14 May 2013, 09:57 AM
Yes i am already getting this XMl in Grid exporting event
gridXML = e.ExportOutput;

but after that immediately response of excel document sent back to the client. I try to stop that response to get another grid xml and to combined them together and then send it to client but no luck and i do not know how it will be done.

Regards, 
0
Daniel
Telerik team
answered on 17 May 2013, 05:19 PM
Hello Sana,

The problem is not how to merge the contents but rather how to get the output from another grid. The export happens too late in the page lifecycle and it is not possible to export two controls to ExcelML in a single lifecycle. Indeed, you can save the first control's XMLSS data and then make a Response.Redirect to export the second one while keeping the data from the first one.
In such cases, it would be better to use the export infrastructure to manually traverse the controls (or their datasources directly) and build the desired structure.

Best regards,
Daniel
the Telerik team
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 RadControls for ASP.NET AJAX, subscribe to their blog feed now.
Tags
Grid
Asked by
Jason
Top achievements
Rank 1
Answers by
Daniel
Telerik team
Paul
Top achievements
Rank 1
Meenakshi
Top achievements
Rank 1
Sunny
Top achievements
Rank 1
Share this question
or