Using FileField in UserControl

M

Mau

Hi
I have a little problem but I'm not able
to solve it....

I'm writing an User control (ascx)
I wanto to insert a FileField control (FileUpload in Webmatrix)
to manage the upload of a file.

The problem is that the containing form
MUST have enctype = "multipart/form-data"
but I can't change it (because I work only
with the user control and I can't change the
pages that use it...)

Some ideas?

tnks

M
 
K

Karl Seguin

The only thing I can suggest is that you change the value programatically:

//C#
((HtmlForm)Page.FindControl("Form1")).Enctype = "multipart/form-data";

or

'VB.Net
ctype(Page.FindControl("Form1"), HtmlForm).Enctype = "multipart/form-data"

Where Form1 is the name of the form. Alternatively, you could expose the
form in your page as a public property and access it like this (but I'm
assuming you have no control of the page).

Karl
 
M

Mau

//C#
((HtmlForm)Page.FindControl("Form1")).Enctype = "multipart/form-data";

I'll use this tip, thanks
Where Form1 is the name of the form. Alternatively, you could expose the
form in your page as a public property and access it like this (but I'm
assuming you have no control of the page).
Exactly, I hope that the name of the form will never change

By

M
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Top