barski Posted October 30, 2003 Posted October 30, 2003 How do you download a file to the client? I've used the streamwriter but as far as I can tell it is only for saving files to the server not the client. I know there's a way because I've downloaded things from this forum. Quote
Moderators Robby Posted October 30, 2003 Moderators Posted October 30, 2003 How about just providing a link to the file. Quote Visit...Bassic Software
barski Posted October 30, 2003 Author Posted October 30, 2003 Here's the thing. I have a dataset that contains let's say 210 records that I'm displaying in a grid with the paging set at 25. I want the user to be able to save the entire dataset to there machine. Also, I would prefer it if the user didn't have to leave the page in order do download the file. Quote
bungpeng Posted October 31, 2003 Posted October 31, 2003 What format you want the user to download? you can use your method to save the file in server, then use "Response.Redirect" to send it to client. Logically it should works...:) Quote
abarham Posted November 6, 2003 Posted November 6, 2003 I had the same problem. My resolution was to extract the datagrid content to excel, thus allowing the users to save and change the data as required. Try this sample on pageload: ' Set the content type to Excel. Response.ContentType = "application/vnd.ms-excel" ' Remove the charset from the Content-Type header. Response.Charset = "" ' Turn off the view state. Me.EnableViewState = False Dim tw As New System.IO.StringWriter Dim hw As New System.Web.UI.HtmlTextWriter(tw) ' Get the HTML for the control. DataGrid1.RenderControl(hw) ' Write the HTML back to the browser. Response.Write(tw.ToString()) ' End the response. Response.End() Quote
Recommended Posts
Join the conversation
You can post now and register later. If you have an account, sign in now to post with your account.