We use cookies to give you the best experience on our website. If you continue to browse, then you agree to our privacy policy and cookie policy. (Last updated on: November 16, 2018).
Unfortunately, activation email could not send to your email. Please try again.
Syncfusion Feedback

save grid as excel - file download dialog

Thread ID:

Created:

Updated:

Platform:

Replies:

50093 Oct 5,2006 12:08 PM UTC Feb 13,2008 11:30 AM UTC ASP.NET Web Forms (Classic) 2
loading
Tags: FAQ
Irina Jouk
Asked On October 5, 2006 12:08 PM UTC

Hi,

I do the export of grid from web page to excel using
httpResp.ContentType = "application/x-unknown";
httpResp.AddHeader("Content-Disposition", "attachment; filename=" + myfilename + ";");

I set application to unknown and did not add .xls to file name in order not to display ‘open’ button on the file download dialog box, because users do not want that button. The problem is that when user clicks ‘save’ than in save as type dropdown only doc type can be selected, there is no excel spreadsheet in the type selection list. Is there way to control that? May be some parameter of httpResp.ContentType? I need hide ‘open’ button and let user save as excel.

Thanks in advance

Saranyan
Replied On February 13, 2008 11:28 AM UTC

HttpContext.Current.Response.Clear();
HttpContext.Current.Response.AddHeader("Content-Disposition", "attachment; filename=" + strPath.Name);
HttpContext.Current.Response.AddHeader("Content-Length", strPath.Length.ToString());
HttpContext.Current.Response.ContentType = "application/octet-stream";
HttpContext.Current.Response.ContentType = "text";
HttpContext.Current.Response.WriteFile(strPath.FullName);
HttpContext.Current.Response.End();


Saranyan
Replied On February 13, 2008 11:30 AM UTC

HttpContext.Current.Response.ContentType = "text";



CONFIRMATION

This post will be permanently deleted. Are you sure you want to continue?

Sorry, An error occured while processing your request. Please try again later.

Please sign in to access our forum

or the page will be automatically redirected to sign-in page in 10 seconds.

Warning Icon You are using an outdated version of Internet Explorer that may not display all features of this and other websites. Upgrade to Internet Explorer 8 or newer for a better experience.Close Icon

;