Open Documents from List Box
-
Hi Guys I have a web app, and in this web app I have a list box. This list box displays file names of word documents that relate to the project which is displayed in the rest of the app. I have the File names displayed, but the value of the list box is set to the full file path. My question is, how can I open the documents when a user selects a document and clicks on the "Open Document" button? I used a ListBox because I'm quite tight on space... Thank in advance :) edit: I'm using C#
oooo, the Jedi's will feel this one....
-
Hi Guys I have a web app, and in this web app I have a list box. This list box displays file names of word documents that relate to the project which is displayed in the rest of the app. I have the File names displayed, but the value of the list box is set to the full file path. My question is, how can I open the documents when a user selects a document and clicks on the "Open Document" button? I used a ListBox because I'm quite tight on space... Thank in advance :) edit: I'm using C#
oooo, the Jedi's will feel this one....
Paul Unsworth wrote:
My question is, how can I open the documents when a user selects a document and clicks on the "Open Document" button?
You can initiate the File Save As Dialog box on button Click.
Abhijit Jana | Codeproject MVP Web Site : abhijitjana.net Don't forget to click "Good Answer" on the post(s) that helped you.
-
Paul Unsworth wrote:
My question is, how can I open the documents when a user selects a document and clicks on the "Open Document" button?
You can initiate the File Save As Dialog box on button Click.
Abhijit Jana | Codeproject MVP Web Site : abhijitjana.net Don't forget to click "Good Answer" on the post(s) that helped you.
How do you do that? I've tried looking on google, and all I can find are Response.TransmitFile() or Response.WriteFile() which just write the file into the browser just before the page starts. I was playing around with creating a hyperlink object, and setting the navigate url to the files url, but I cannot find a way to activate it. I would have used hyperlinks if space and neatness were not so much of an issue...
oooo, the Jedi's will feel this one....
-
How do you do that? I've tried looking on google, and all I can find are Response.TransmitFile() or Response.WriteFile() which just write the file into the browser just before the page starts. I was playing around with creating a hyperlink object, and setting the navigate url to the files url, but I cannot find a way to activate it. I would have used hyperlinks if space and neatness were not so much of an issue...
oooo, the Jedi's will feel this one....
Paul Unsworth wrote:
Response.WriteFile()
That's it, just set the content type first so that the browser knows it's a download, or perhaps a file to be opened in the browser.
Paul Unsworth wrote:
I was playing around with creating a hyperlink object, and setting the navigate url to the files url, but I cannot find a way to activate it.
How do you mean, activate ?
Christian Graus Driven to the arms of OSX by Vista. Read my blog to find out how I've worked around bugs in Microsoft tools and frameworks.
-
Hi Guys I have a web app, and in this web app I have a list box. This list box displays file names of word documents that relate to the project which is displayed in the rest of the app. I have the File names displayed, but the value of the list box is set to the full file path. My question is, how can I open the documents when a user selects a document and clicks on the "Open Document" button? I used a ListBox because I'm quite tight on space... Thank in advance :) edit: I'm using C#
oooo, the Jedi's will feel this one....
Use this when user clicks the button to download the file :
Response.Clear();
Response.ContentType="application/word";
Response.AppendHeader("Content-Disposition","attachment; filename=yourfilename.doc");
Response.TransmitFile(serverfilepath);
Response.End();Cheers. :rose:
Abhishek Sur **Don't forget to click "Good Answer" if you like this Solution.
My Latest Articles-->** Simplify Code Using NDepend
Basics of Bing Search API using .NET
Microsoft Bing MAP using Javascript -
Paul Unsworth wrote:
Response.WriteFile()
That's it, just set the content type first so that the browser knows it's a download, or perhaps a file to be opened in the browser.
Paul Unsworth wrote:
I was playing around with creating a hyperlink object, and setting the navigate url to the files url, but I cannot find a way to activate it.
How do you mean, activate ?
Christian Graus Driven to the arms of OSX by Vista. Read my blog to find out how I've worked around bugs in Microsoft tools and frameworks.
By activate, I mean somehow make it think it has been clicked. I was just experimenting with that one. I suppose I was just trying to cheat. :-O Thank you for your reply. :)
oooo, the Jedi's will feel this one....
-
Use this when user clicks the button to download the file :
Response.Clear();
Response.ContentType="application/word";
Response.AppendHeader("Content-Disposition","attachment; filename=yourfilename.doc");
Response.TransmitFile(serverfilepath);
Response.End();Cheers. :rose:
Abhishek Sur **Don't forget to click "Good Answer" if you like this Solution.
My Latest Articles-->** Simplify Code Using NDepend
Basics of Bing Search API using .NET
Microsoft Bing MAP using JavascriptThat was the exact ticket! Thank you. :-D
oooo, the Jedi's will feel this one....