Velocity Reviews - Computer Hardware Reviews

Velocity Reviews > Newsgroups > Programming > ASP .Net > Using OpenFileFialog in asp.net web

Reply
Thread Tools

Using OpenFileFialog in asp.net web

 
 
=?Utf-8?B?V2lsbGVt?=
Guest
Posts: n/a
 
      01-30-2005
Hi,

I am creating a web application in asp.net in which I have to show an
openfiledialog box to select the file and display the selected file with its
path in a text box.
I try to solve this problem with the System.Windows.Forms.OpenFileFialog.

I use

Imports System.Windows.Forms

In the sub the code is like...

Dim ofd As OpenFileDialog = New OpenFileDialog

If ofd.ShowDialog() = DialogResult.OK Then
txtPath.Text = ofd.FileName()
End If


I get the following Error.


It is invalid to show a modal dialog or form when the application is not
running in UserInteractive mode.Specify the ServiceNotification or
DefaultDesktopOnly style to display a notification from a service application.

What should I do to get the openfiledialog box to appear?
Where can I Specify the ServiceNotification?
Is it possible at all to use the System.Windows.Forms base in a Web form?

I'm not that familiar with asp.net.

Many thanks!
 
Reply With Quote
 
 
 
 
Elton Wang
Guest
Posts: n/a
 
      01-30-2005
Hi Willem,

You can't use Windows component, such as OpenFileDialog,
on web server-side. You may use HtmlInputFile, HTML <input
type= file> element, to select file on client-side.

Hope it helps,

Elton Wang
http://www.velocityreviews.com/forums/(E-Mail Removed)


>-----Original Message-----
>Hi,
>
>I am creating a web application in asp.net in which I

have to show an
>openfiledialog box to select the file and display the

selected file with its
>path in a text box.
>I try to solve this problem with the

System.Windows.Forms.OpenFileFialog.
>
>I use
>
>Imports System.Windows.Forms
>
>In the sub the code is like...
>
>Dim ofd As OpenFileDialog = New OpenFileDialog
>
>If ofd.ShowDialog() = DialogResult.OK Then
> txtPath.Text = ofd.FileName()
>End If
>
>
>I get the following Error.
>
>
>It is invalid to show a modal dialog or form when the

application is not
>running in UserInteractive mode.Specify the

ServiceNotification or
>DefaultDesktopOnly style to display a notification from a

service application.
>
>What should I do to get the openfiledialog box to appear?
>Where can I Specify the ServiceNotification?
>Is it possible at all to use the System.Windows.Forms

base in a Web form?
>
>I'm not that familiar with asp.net.
>
>Many thanks!
>.
>

 
Reply With Quote
 
 
 
 
Willem
Guest
Posts: n/a
 
      01-30-2005
Thats easy!

Many thanks

Willem

>-----Original Message-----
>Hi Willem,
>
>You can't use Windows component, such as OpenFileDialog,
>on web server-side. You may use HtmlInputFile, HTML

<input
>type= file> element, to select file on client-side.
>
>Hope it helps,
>
>Elton Wang
>(E-Mail Removed)
>
>
>>-----Original Message-----
>>Hi,
>>
>>I am creating a web application in asp.net in which I

>have to show an
>>openfiledialog box to select the file and display the

>selected file with its
>>path in a text box.
>>I try to solve this problem with the

>System.Windows.Forms.OpenFileFialog.
>>
>>I use
>>
>>Imports System.Windows.Forms
>>
>>In the sub the code is like...
>>
>>Dim ofd As OpenFileDialog = New OpenFileDialog
>>
>>If ofd.ShowDialog() = DialogResult.OK Then
>> txtPath.Text = ofd.FileName()
>>End If
>>
>>
>>I get the following Error.
>>
>>
>>It is invalid to show a modal dialog or form when the

>application is not
>>running in UserInteractive mode.Specify the

>ServiceNotification or
>>DefaultDesktopOnly style to display a notification from

a
>service application.
>>
>>What should I do to get the openfiledialog box to

appear?
>>Where can I Specify the ServiceNotification?
>>Is it possible at all to use the System.Windows.Forms

>base in a Web form?
>>
>>I'm not that familiar with asp.net.
>>
>>Many thanks!
>>.
>>

>.
>

 
Reply With Quote
 
 
 
Reply

Thread Tools

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is On
HTML code is Off
Trackbacks are On
Pingbacks are On
Refbacks are Off


Similar Threads
Thread Thread Starter Forum Replies Last Post
Using Web.config's <system.web><pages><controls><add /></controls></pages></system.web> To Register UserControls Nathan Sokalski ASP .Net 5 01-10-2007 10:50 AM
Using Web.config's <system.web><pages><controls><add /></controls></pages></system.web> To Register UserControls Nathan Sokalski ASP .Net Web Controls 4 12-21-2006 02:50 AM
Using Web.config's <system.web><pages><controls><add /></controls></pages></system.web> To Register UserControls Nathan Sokalski ASP .Net Building Controls 4 12-21-2006 02:50 AM
Web Clients, the role of ASP.NET and the Future of Web Development and Web Standards Guadala Harry ASP .Net 9 11-06-2004 03:05 AM
Conflicting Web.config between web site and web service Joe ASP .Net 1 10-28-2004 11:14 PM



Advertisments