Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations bkrike on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

FolderBrowserDialog

Status
Not open for further replies.

Katy44

Technical User
Dec 12, 2003
723
GB
I am trying to use the FolderBrowserDialog option to allow users to browse for a folder. I can't seem to get it to import System.Windows.Forms which I assume I need - it says: Namespace or type...cannot be found.

I am using VB.NET and .NET v1.1
Any help on this would be appreciated, thanks
 
Hi

You can't import the System.Windows.Forms namespace into an ASP.NET application. ASP.NET applications are for web delivery and therefore cannot include any windows forms functionality. If you are looking to allow a user to upload a file then try the HtmlInputFile class in the System.Web.UI.HtmlControls namespace.

If you just want a folder dialog without any return action you may be able to screw with the browser enough using CSS to get a button which opens a dialog without the associated textbox showing...

Rob

Go placidly amidst the noise and haste, and remember what peace there may be in silence - Erhmann 1927
 
Thank you for clearing that up for me! I don't want them to upload a file, but am allowing them to export a report on the website, so want to allow them to specify the folder path and what they want the report to be called. Is there a standard way to do this, or should I just allow them to type the path into a text box?
 
What format is the report in? The "standard" HTTP method for this is to return the file with a content type which indicates its format e.g. excel, word, pdf etc. What happens on the client depends on the settings on the user machine. Some will be set to open in the browser window using a plug-in others in a new window using the relevant software. Its not always possible to force a save dialog to pop-up over the web as you have no control over the client machine. However, if the browser doesnt recognise the format of the file then it will always offer the user to save it instead of open.

Rob

Go placidly amidst the noise and haste, and remember what peace there may be in silence - Erhmann 1927
 
It's a Crystal Report which opens through a Crystal Report Viewer, but I have also added a button to allow to export in PDF format. I'm not sure what I should be doing for the best in this situation.
 
How you achieve this depends on wether the fiel you are offering for download/export exists on the server or not. Or wetehr you are prepared to create the file on the server for them to download.

Assuming the file exists on the server then the simplest method is to redirect the client browser to the file to download. How the client deals with this is beyond your control but it will give your users the option to save the file either way.

If you want to dynamically create the report and send it to the client without it existing on the server then you will need to change the content type of the Response object to the appropriate type and then add the file to the response stream. The effect will be the same as above but without the file ever existing on the server. Check out the numerous threads in this forum on exporting data as excel for the principle ehind this.

Rob

Go placidly amidst the noise and haste, and remember what peace there may be in silence - Erhmann 1927
 
Thank you, I will look up the suggestions you mentioned.
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top