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