469,917 Members | 1,473 Online
Bytes | Developer Community
New Post

Home Posts Topics Members FAQ

Post your question to a community of 469,917 developers. It's quick & easy.

Prompt user with OpenFile dialog

Hi All,

I am trying to replicate the functionality of the HTML FileField control
(<INPUT type="file">). It does everything I need but for one thing: I
can't programmatically set the value of the FileField control - all the
reading I have done says that it is impossible for security reasons.

So, I want to use a standard Server controls: a TextBox control and a Button
control, and replicate the functionality of the FileField HTML control.
When the user clicks a "Browse" button, s/he should be presented with a the
standard Windows OpenFile dialogue box, and when the user selects the file,
the full path (including file name) should be plonked into the TextBox.
This way, I can programmatically set the text property of the TextBox.

Any help greatly appreciated.

Cheers,

Mr Gordonz

Nov 17 '05 #1
1 1202
Hi Carl,

I tried that, and it doesn't work. Apparently, this particular control was
designed to NEVER allow its value to be set programmatically. I gather it
was seen as a potential security vulnerability, and so the value property
can't be set programmatically even when it is run as a server control.

Cheers,

MG

"Carl Howarth" <ca**********@m-s-solutions.co.uk> wrote in message
news:%2****************@TK2MSFTNGP09.phx.gbl...
If you right click on the control from within vs.net, you will be able to
set it to runat server, this will declare it in the backend code thus you
will be able to set properties etc.

Carl

"Mr Gordonz" <pa**@mobius.net.au> wrote in message
news:uk**************@tk2msftngp13.phx.gbl...
Hi All,

I am trying to replicate the functionality of the HTML FileField control
(<INPUT type="file">). It does everything I need but for one thing: I
can't programmatically set the value of the FileField control - all the
reading I have done says that it is impossible for security reasons.

So, I want to use a standard Server controls: a TextBox control and a

Button
control, and replicate the functionality of the FileField HTML control.
When the user clicks a "Browse" button, s/he should be presented with a

the
standard Windows OpenFile dialogue box, and when the user selects the

file,
the full path (including file name) should be plonked into the TextBox.
This way, I can programmatically set the text property of the TextBox.

Any help greatly appreciated.

Cheers,

Mr Gordonz


Nov 17 '05 #2

This discussion thread is closed

Replies have been disabled for this discussion.

Similar topics

4 posts views Thread by dave | last post: by
3 posts views Thread by J.P. Cummins | last post: by
2 posts views Thread by ambersaria420 | last post: by
3 posts views Thread by Billy Cormic | last post: by
4 posts views Thread by Henry C. Wu | last post: by
4 posts views Thread by Marco Trapanese | last post: by
1 post views Thread by Waqarahmed | last post: by
By using this site, you agree to our Privacy Policy and Terms of Use.