Click here to Skip to main content
15,892,059 members
Please Sign up or sign in to vote.
0.00/5 (No votes)
See more:
Hi everybody,
I am calling the ExportToExcelGrid.ashx file as u can see in the below code from calling.aspx:

string link = null;
MenuItemSchema menuItem  = null;
link = HttpContext.Current.Request.ApplicationPath + "_controltemplates/Folder/Handlers/ExportToExcelGrid.ashx";
string onClickEvent = "javascript:window.location = '" + link + "';";
menuItem = new MenuItemSchema("Export", "Analyze items.", "Export", "", "/_layouts/images/MenuSpreadsheet.gif", false, onClickEvent);
menu.Items.Add(menuItem);


Here the postbacktrigger is made false.
ExportToExcelGrid.ashx has the code to Export data to excel using System.IO.StringWriter and HtmlTextWriter objects from the Dataset.
Now I need to show an alert msg using

context.Response.Write("<script type='text/javascript'>alert('Hello, world');</script>"); 


using the ExportToExcelGrid.ashx.

Here the page is getting redirected from calling.aspx to the ExportToExcelGrid.ashx and then the alert msg is shown. But in the case of export to excel even though the page is redirected to the ExportToExcelGrid.ashx a message is prompted to the user to save/open the excel file, over the calling.aspx and not on the handler file.

I needed to redirect to ExportToExcelGrid.ashx but still show the alert msg above the calling.aspx, just like the Excel msg prompt.

Kindly let me know on this.

Thanks and Regards.
G.Chetan
Posted
Updated 4-May-10 19:34pm
v2

This content, along with any associated source code and files, is licensed under The Code Project Open License (CPOL)



CodeProject, 20 Bay Street, 11th Floor Toronto, Ontario, Canada M5J 2N8 +1 (416) 849-8900