473,324 Members | 2,002 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,324 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 12528
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: ryjfgjl | last post by:
ExcelToDatabase: batch import excel into database automatically...
0
by: Vimpel783 | last post by:
Hello! Guys, I found this code on the Internet, but I need to modify it a little. It works well, the problem is this: Data is sent from only one cell, in this case B5, but it is necessary that data...
0
by: ArrayDB | last post by:
The error message I've encountered is; ERROR:root:Error generating model response: exception: access violation writing 0x0000000000005140, which seems to be indicative of an access violation...
1
by: PapaRatzi | last post by:
Hello, I am teaching myself MS Access forms design and Visual Basic. I've created a table to capture a list of Top 30 singles and forms to capture new entries. The final step is a form (unbound)...
1
by: Defcon1945 | last post by:
I'm trying to learn Python using Pycharm but import shutil doesn't work
1
by: Shællîpôpï 09 | last post by:
If u are using a keypad phone, how do u turn on JavaScript, to access features like WhatsApp, Facebook, Instagram....
0
by: af34tf | last post by:
Hi Guys, I have a domain whose name is BytesLimited.com, and I want to sell it. Does anyone know about platforms that allow me to list my domain in auction for free. Thank you
0
by: Faith0G | last post by:
I am starting a new it consulting business and it's been a while since I setup a new website. Is wordpress still the best web based software for hosting a 5 page website? The webpages will be...
0
isladogs
by: isladogs | last post by:
The next Access Europe User Group meeting will be on Wednesday 3 Apr 2024 starting at 18:00 UK time (6PM UTC+1) and finishing by 19:30 (7.30PM). In this session, we are pleased to welcome former...

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.