473,405 Members | 2,349 Online
Bytes | Software Development & Data Engineering Community
Post Job

Home Posts Topics Members FAQ

Join Bytes to post your question to a community of 473,405 software developers and data experts.

Using FileField in UserControl

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
Nov 18 '05 #1
2 1458
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

--
MY ASP.Net tutorials
http://www.openmymind.net/
"Mau" <no*@sorry.com> wrote in message
news:Su********************@twister2.libero.it...
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

Nov 18 '05 #2
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
Nov 18 '05 #3

This thread has been closed and replies have been disabled. Please start a new discussion.

Similar topics

3
by: Todd Schinell | last post by:
Back in July, Jeffery Tan posted this: http://groups.google.com/groups?hl=en&lr=&ie=UTF-8&oe=UTF-8&selm=OWOTdf0VDHA.2296%40cpmsftngxa06.phx.gbl In response as to how to get click events from a...
2
by: crjunk | last post by:
I have a droped a UserControl named "ReceivedRecord1" onto my web form. Currently, I have been saving information typed in by the user with the following code that is located in the CodeBehind...
2
by: Ric | last post by:
im new to asp.net. from what i understand, you have the aspx file (presentation), user-control(ascx file), code-behind(vb file) and components(compiled vb and dll files). the aspx file contains a...
0
by: msuk | last post by:
All, I have a asp.net c# webform that contains a filefield control where a user is able to upload a MS Office .doc file. I would like check the file is a ..doc file does anyone know how this...
2
by: Hans Merkl | last post by:
Hi, I am trying to use a user control as EditItemTemplate in a DataList. It loads fine but I can't figure out how to bind to the data of the DataList. Here is what I have got so far: ...
12
by: Joe | last post by:
Hello All: Do I have to use the LoadControl method of the Page to load a UserControl? I have a class which contains three methods (one public and two private). The class acts as a control...
7
by: crowl | last post by:
VS.2003, .NET Framework 1.1, C# My goal: Creating a dll (helper.dll) which contains some UserControls and some other helpful classes in order to use it in other projects. Symtoms: The...
5
by: daniel.hedz | last post by:
I am generating a usercontrol dynamically successfully, but when I try to find that usercontrol I get a type mismatch. This is what I am doing: //Loading my usercontrol...
6
by: tshad | last post by:
I was looking at a page that showed how to set up a custom event and it seems to work ok. But I am not sure how I would use it. How would I subscribe to it. There is actual action (such as...
0
by: Charles Arthur | last post by:
How do i turn on java script on a villaon, callus and itel keypad mobile phone
0
by: emmanuelkatto | last post by:
Hi All, I am Emmanuel katto from Uganda. I want to ask what challenges you've faced while migrating a website to cloud. Please let me know. Thanks! Emmanuel
0
BarryA
by: BarryA | last post by:
What are the essential steps and strategies outlined in the Data Structures and Algorithms (DSA) roadmap for aspiring data scientists? How can individuals effectively utilize this roadmap to progress...
1
by: nemocccc | last post by:
hello, everyone, I want to develop a software for my android phone for daily needs, any suggestions?
1
by: Sonnysonu | last post by:
This is the data of csv file 1 2 3 1 2 3 1 2 3 1 2 3 2 3 2 3 3 the lengths should be different i have to store the data by column-wise with in the specific length. suppose the i have to...
0
by: Hystou | last post by:
There are some requirements for setting up RAID: 1. The motherboard and BIOS support RAID configuration. 2. The motherboard has 2 or more available SATA protocol SSD/HDD slots (including MSATA, M.2...
0
marktang
by: marktang | last post by:
ONU (Optical Network Unit) is one of the key components for providing high-speed Internet services. Its primary function is to act as an endpoint device located at the user's premises. However,...
0
by: Hystou | last post by:
Most computers default to English, but sometimes we require a different language, especially when relocating. Forgot to request a specific language before your computer shipped? No problem! You can...
0
tracyyun
by: tracyyun | last post by:
Dear forum friends, With the development of smart home technology, a variety of wireless communication protocols have appeared on the market, such as Zigbee, Z-Wave, Wi-Fi, Bluetooth, etc. Each...

By using Bytes.com and it's services, you agree to our Privacy Policy and Terms of Use.

To disable or enable advertisements and analytics tracking please visit the manage ads & tracking page.