about file type
-
i am using following code behind a push button..... Response.ContentType = "application/vnd.ms-excel"; this.EnableViewState = false; Response.Charset = String.Empty; System.IO.StringWriter myTextWriter =new System.IO.StringWriter(); System.Web.UI.HtmlTextWriter myHtmlTextWriter = new System.Web.UI.HtmlTextWriter(myTextWriter); this.datagrid1.RenderControl(myHtmlTextWriter); Response.Write(myTextWriter.ToString()); Response.End(); now on runtime , when i pushes the button, then a dialog (window save dialog) appears, asking me, about the name which i want to give the saving file. This dialog shows name of application as default name of saving file. I want that the default name shown in the save dialog should be name of application plus the current date. Can some body help me in this way.....
-
i am using following code behind a push button..... Response.ContentType = "application/vnd.ms-excel"; this.EnableViewState = false; Response.Charset = String.Empty; System.IO.StringWriter myTextWriter =new System.IO.StringWriter(); System.Web.UI.HtmlTextWriter myHtmlTextWriter = new System.Web.UI.HtmlTextWriter(myTextWriter); this.datagrid1.RenderControl(myHtmlTextWriter); Response.Write(myTextWriter.ToString()); Response.End(); now on runtime , when i pushes the button, then a dialog (window save dialog) appears, asking me, about the name which i want to give the saving file. This dialog shows name of application as default name of saving file. I want that the default name shown in the save dialog should be name of application plus the current date. Can some body help me in this way.....
Hi there, In this case, you should use the Content-Disposition header field, and you can make use of the filename parameter to suggest a name that will be displayed in the File Download dialog box on the client side. The sample code is something look like this:
string suggestedName = Your Application Name + Current Date;
Response.AddHeader("Content-Disposition", "attachment; filename=" + suggestedName + ";");
-
Hi there, In this case, you should use the Content-Disposition header field, and you can make use of the filename parameter to suggest a name that will be displayed in the File Download dialog box on the client side. The sample code is something look like this:
string suggestedName = Your Application Name + Current Date;
Response.AddHeader("Content-Disposition", "attachment; filename=" + suggestedName + ";");