473,396 Members | 1,929 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,396 software developers and data experts.

File upload inside a usercontrol inside an updatepanel

Having a bit of trouble here. I know that if you want to use a fileupload
control inside an AJAX update panel then you need to create a trigger for
the control that performs the uploading postback to the updatepanel, but the
problem is, I have an update panel inside a web usercontrol, and the
usercontrol is sitting inside an updatepanel on the host page. I therefore
can't add a trigger to the control directly, as the host page has no access
to the button within the usercontrol.

Does anyone know a way round this?

Jun 27 '08 #1
5 12545
as you don't want the fileupload to trigger a async postback (it needs to do
a browser postback to work), just be sure its not a trigger to the panel its
inside.

-- bruce (sqlwork.com)
"Leon Mayne" wrote:
Having a bit of trouble here. I know that if you want to use a fileupload
control inside an AJAX update panel then you need to create a trigger for
the control that performs the uploading postback to the updatepanel, but the
problem is, I have an update panel inside a web usercontrol, and the
usercontrol is sitting inside an updatepanel on the host page. I therefore
can't add a trigger to the control directly, as the host page has no access
to the button within the usercontrol.

Does anyone know a way round this?
Jun 27 '08 #2
ScriptManager.RegisterPostBackControl does the equivalent in code (you get
reference to SM with ScriptManager.GetCurrent())

"Use the RegisterPostBackControl method to register postback controls inside
an UpdatePanel control as triggers. Controls that are registered by using
this method update a whole page instead of updating only the UpdatePanel
control's content. Registering a postback control with this method outside
an UpdatePanel control has no affect because by default these controls do
not perform asynchronous postbacks"

--
Teemu Keiski
AspInsider, ASP.NET MVP
http://blogs.aspadvice.com/joteke
http://teemukeiski.net

"Leon Mayne" <le**@rmvme.mvps.orgwrote in message
news:92**********************************@microsof t.com...
Having a bit of trouble here. I know that if you want to use a fileupload
control inside an AJAX update panel then you need to create a trigger for
the control that performs the uploading postback to the updatepanel, but
the problem is, I have an update panel inside a web usercontrol, and the
usercontrol is sitting inside an updatepanel on the host page. I therefore
can't add a trigger to the control directly, as the host page has no
access to the button within the usercontrol.

Does anyone know a way round this?

Jun 27 '08 #3
"Teemu Keiski" <jo****@aspalliance.comwrote in message
news:eb**************@TK2MSFTNGP04.phx.gbl...
ScriptManager.RegisterPostBackControl does the equivalent in code (you get
reference to SM with ScriptManager.GetCurrent())

"Use the RegisterPostBackControl method to register postback controls
inside an UpdatePanel control as triggers. Controls that are registered by
using this method update a whole page instead of updating only the
UpdatePanel control's content. Registering a postback control with this
method outside an UpdatePanel control has no affect because by default
these controls do not perform asynchronous postbacks"
Damn, almost worked, but it looks like neither the file upload control nor a
panel implement an appropriate interface:

"Control with ID 'pnlUpload' being registered through
RegisterAsyncPostBackControl or RegisterPostBackControl must implement
either INamingContainer, IPostBackDataHandler, or IPostBackEventHandler."

Jun 27 '08 #4
"bruce barker" <br*********@discussions.microsoft.comwrote in message
news:C5**********************************@microsof t.com...
as you don't want the fileupload to trigger a async postback (it needs to
do
a browser postback to work), just be sure its not a trigger to the panel
its
inside.
OK, do you know how to make just the file upload control not a trigger? The
rest of the controls in the usercontrol need to be triggers, but because
there is an extra layer between the update panel and the file upload control
I can't directly reference one from the other.

I guess I could make the control public, but wouldn't this get overwritten
as soon as the designer file is updated?

Jun 27 '08 #5
"Leon Mayne" <le**@rmvme.mvps.orgwrote in message
news:3A**********************************@microsof t.com...
"Teemu Keiski" <jo****@aspalliance.comwrote in message
news:eb**************@TK2MSFTNGP04.phx.gbl...
>ScriptManager.RegisterPostBackControl does the equivalent in code (you
get reference to SM with ScriptManager.GetCurrent())

"Use the RegisterPostBackControl method to register postback controls
inside an UpdatePanel control as triggers. Controls that are registered
by using this method update a whole page instead of updating only the
UpdatePanel control's content. Registering a postback control with this
method outside an UpdatePanel control has no affect because by default
these controls do not perform asynchronous postbacks"

Damn, almost worked, but it looks like neither the file upload control nor
a panel implement an appropriate interface:

"Control with ID 'pnlUpload' being registered through
RegisterAsyncPostBackControl or RegisterPostBackControl must implement
either INamingContainer, IPostBackDataHandler, or IPostBackEventHandler."
Oh wait, I registered the wrong control. I changed it to register the button
instead and it worked:

Dim scmCurrent As ScriptManager = ScriptManager.GetCurrent(Me.Page)
If scmCurrent IsNot Nothing Then
scmCurrent.RegisterPostBackControl(Me.btnUpload)
End If

Thanks Teemu.

Jun 27 '08 #6

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

Similar topics

6
by: Marko Vuksanovic | last post by:
I am trying to implement a file upload progress indicator (doesn't have to be a progress bar) using atlas... I do realize that the indicator cannot be implemented using Update panel control, but is...
4
by: Marko Vuksanovic | last post by:
I am trying to cause the uplaod button, id="Upload",when clicked, to exectue the onClick event for Button1, id="Button1". <asp:FileUpload id="FileUpload" runat="server"> </asp:FileUpload>...
1
by: Ram | last post by:
hi, i'm trying to upload files. i used <input type=file id=Uploadfile runat=server">. i have placed the control in Updatepanel(AJAX) when i'm trying to upload it.. it is showing Object...
2
by: Bjorn Sagbakken | last post by:
I was looking for a solution, without the full page postback, and all the tip was about a hidden iframe and RJS. The RJS was not known to me before, and still I haven't explored this used with...
3
by: Nathan Sokalski | last post by:
I have a FileUpload control which is inside an UpdatePanel which is inside a TabPanel. In my code, I use the FileUpload's HasFile and FileContent.Length properties. However, after I select a file,...
3
by: shapper | last post by:
Hello, I need to upload a file. Can I only do this with the File Upload control? I also need the following: - Send upload info, upload percentage, continuously to a JavaScript function so...
7
Curtis Rutland
by: Curtis Rutland | last post by:
Building A Silverlight (2.0) Multi-File Uploader All source code is C#. VB.NET source is coming soon. Note: This project requires Visual Studio 2008 SP1 or Visual Web Developer 2008 SP1 and...
3
by: premprakashbhati | last post by:
hi, good evening.. i am going to upload an image in a web form .....for that iam using HTML input(file) control and one web control button i.e., Upload_Button() here is the code ...its work fine...
9
by: TimVtoo | last post by:
asp VB.NET How can I pass a value to my user controls in the example below From the Master Page?... it's driving me nuts! The scenario: <MasterPage> <UpdateTrigger/> <ContentPlaceHolder...
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: ryjfgjl | last post by:
In our work, we often receive Excel tables with data in the same format. If we want to analyze these data, it can be difficult to analyze them because the data is spread across multiple Excel files...
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
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
agi2029
by: agi2029 | last post by:
Let's talk about the concept of autonomous AI software engineers and no-code agents. These AIs are designed to manage the entire lifecycle of a software development project—planning, coding, testing,...

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.