Performing File Upload using update panel and update progress


 Hi guys

I'm totally new to ajax, and Im using vs2005 and ajax 1 with .net 2.0

I've created a form for my application that allows a user to upload a file to a database. The form contains a fileupload, a button (that invokes the insert) and a repeater that lists all the files currently stored. This works great.

Now I want to use ajax to display an 'uploading...' message and animation to displaye while the file is being uploaded. Depending on the file, uploading can take quite a while, and I wanted to include some feedback to the user to let them know what's happening. I've gone through the ajax tutorial videos on getting started and using update panels etc, as well as on the update progress feature. I cnat seem to get it to work.

I first placed the repeater inside the update panel, and set up a trigger for my upload button. This didnt work. I've tried including all my controls inside the update panel, some in some out, and a few different combinations. Files are no longer uploading, (when I'm including update panels) and the update progress does nothing.

Can anyone give me a few pointers on where I should be placing the update panel, and which of my controls should go inside for both my normal functionality and my progress to work properly.

Thanks in advance

Reply dhassen 1/18/2008 11:48:30 AM 13973 articles. 1 followers. Follow

4 Replies

Similar Articles

[PageSpeed] 40

You're not going to be able to do that easily.  The only way to provide async file uploads is to put the upload element in an iframe.  Unless you use a PostbackTrigger to force a full postback, it won't work in an UpdatePanel, by design.

Encosia - ASP.NET, AJAX, and more.

Latest article: Using complex types to make calling services less… complex
Reply gt1329a 1/18/2008 2:28:23 PM

 thanks for your reply. I've already applied a Postback trigger, which of course allows the upload, but takes away the functionality of the aysnc postback and the update prorgress. This means I may as well stick with what I had before. All I really want is some feedback while the file is being uploaded. Clearly it's not as simple as I thought!!! Thanks for the link, that was helpful. How would I go about using an iframe in the manner you mention? Thanks

Reply dhassen 1/18/2008 2:42:00 PM

You just place the upload element in an iframe that's sized to inconspicuously contain it.  So, then it appears that the upload happens asynchronously.

However, that method won't get you any closer to an upload progress indicator, unfortunately.   

Encosia - ASP.NET, AJAX, and more.

Latest article: Using complex types to make calling services less… complex
Reply gt1329a 1/18/2008 3:14:36 PM

 ah right, thanks anyway

Reply dhassen 1/18/2008 3:20:44 PM
Similar Artilces:

Having an issue using JavaScript to update an Update Panel with Multiple Update Panels
I am using JavaScript via the '__doPostBack' command passing in the 'ClientID' of my UpdatePanel to do a partial page postback.  This fires the UpdatePanel_PreRender event (or any other UpdatePanel event) where I run server side code. The actual partial page postback is working as expected, but since partial postbacks follow the full page lifecycle, ALL of my UpdatePanel events are firing which I do not want.  What ends up happening is the code in the other UpdatePanel '_PreRender' event is being called too which I do not want to occur. Is there a way aroun...

How to use the Update Panels and Update progress bars in aspx page?
Hi , Usage of update panels in the aspx pages? Thanks, Venugopal Anthana   Hi, take a look at the samples of the official documentation:  Grz, Kris.Read my blog. Handy Firefox plugins for web developers.Workaround for non working Mark as answer buttons....

disable button while processing using Update Panel & Update Progress
I used this code below to disable the button while processing 'Build Function to submitDim sb As New System.Text.StringBuilder() sb.AppendLine("function doSubmit(btn){")sb.AppendLine(ClientScript.GetPostBackEventReference(Me.Button4, [String].Empty)) 'control to disablesb.AppendLine("if(btn !=null) {") sb.AppendLine("btn.disabled='disabled';")sb.AppendLine("}") sb.AppendLine("return false;")sb.AppendLine("}") ClientScript.RegisterStartupScript(Me.[GetType](), "customPB", sb.ToString(), True) Me....

Update panel and update progress
Hello everyone, I am having a problem with an update progress which is in an update panel. With an AsyncPostBack it gives an error with: workbook.SaveAs("Excel.xls", ExcelSaveType.SaveAsXLS, Response, ExcelDownloadType.PromptDialog) in the code behind; however if I use <asp:PostBackTrigger> it works ... But when I use PostBackTrigger, it doesn't display the update progress. Does anyone happen to know why?<%@ Page Language="VB" AutoEventWireup="false" CodeFile="Excel.aspx.vb" Inherits="_Excel" %> <!DOCTYPE html PUBLIC ...

Performance Issues using 10 AJAX Update Panels
Hello        I am having speed issues with one of my pages that has 10 update panels.        Each panel has a number of text boxes (with postback) that accept numerical values and update other parts of the page.        I conditionally update only those panels that need to be refreshed but it is still too slow.        I use fiddler to monitor the traffic and still see a large chunk of HTML being returned between 35KB and 55KB.      &nb...

updates, updates, updates
Name: hans jensen Email: hansjensen44_athotmaildotcom Product: Firefox Summary: updates, updates, updates Comments: why is it everytime i go online firefox has new updates, 3 -4 times every day, its never ending..........whats all the problems??? please email me and let me know, ty,.........Hans Jensen Browser Details: Mozilla/5.0 (Windows; U; Windows NT 5.1; en-US; rv: Gecko/20070219 Firefox/ ...

updates, updates, updates
Holy Crap, Batman! You'd think I was running Windows XP and it's patch Tuesday. So far this week - new kernel (, 2 new browsers (Opera 9.63 and Firefox 3.05) and a new plugin (Flash I'm about ready to try one od the BSD's! vince wrote: > Holy Crap, Batman! You'd think I was running Windows XP and it's patch > Tuesday. > > So far this week - new kernel (, 2 new browsers (Opera 9.63 > and Firefox 3.05) and a new plugin (Flash I'm about ready > to try one od the BSD's! I take ...

updates, updates, updates, NO MORE!
Name: Andreas Email: unbekanntatjokerdotms Product: Firefox Summary: updates, updates, updates, NO MORE! Comments: Hi ! if you want to develop a fine webbrowser, maybe you nee a new management. To release a new buggy version every two weeks is not very professional. Test your software before the release and let the user download a stable browser. this update-orgy since 2.0.0 used me to use Opera instead of FF. We haved use FF in our Company, but we can't deploy a new version every week to +200 Windows-clients, so in our company we've decided to return to IE, ...

Updates Updates Updates
I was a big fan of Firefox.. Now, I don't even like to use it. Seems like every time I start it up I have to update some addin OR the browser itself. And unfortunately the update nag messages are always presented when I start a browsing session. I find this annoying because, typically, when I open a web browser all I want to do is go to a web page. Not update the browser. I can agree that staying current with the latest version could give the best, fastest, safest web experience. But that point becomes mute when I start off every other browsing session with a new update. And mos...

Updates, updates and more updates
Name: pirhan Email: pirhan_chanathotmaildotcom Product: Firefox Summary: Updates, updates and more updates Comments: Hello, Normally I use Safari, but my iBook is out of commission for a while. So, I am forced to use a PC to which I would much rather use Firefox than Internet Exploder. However, as much I enjoy not using a Microsoft product, and use a product that works decently, I am severely annoyed about the constant updates I am put through. In the last two days, I had to wait for Firefox to install updates before I could browse and now, I'm alerted that there'...

how to use the update progress when the update panel is set conditional amd childrentrigger=false??
I am starting to use update panels. In my app some of my panels are set as: ChildrenAsTriggers="false" UpdateMode="Conditional" now how do i trigger the update progress control to display and hide since it does not do it automaticly when using these settings?   The ChildrenAsTriggers property is intended to be used only when the UpdateMode property is set to Conditional. var prm = Sys.WebForms.PageRequestManager.getInstance();prm.add_initializeRequest(InitializeRequest);function InitializeRequest(sender, args) {  if (prm.get_isInAsyncPostBack())  ...

Problem with File Upload using AJAX Update Panel
Hello Friends,    I have an default.aspx page.In that page i have included an user control named Upload.ascx. In Upload.ascx i have the fileupload control and upload button.My friends told me to use the below code  <asp:UpdatePanel ID="UpdatePanel1" UpdateMode="Conditional" runat="server">    <ContentTemplate><asp:FileUpload id="FileUpload1"                            runat=&qu...

Using Control inside Update Panel as a Trigger for another Update Panel
I've got a series of combo boxes.  Combo1 is a trigger for a server side event that I use manipulate values in Combo2, which is in an update panel.  Then I want Combo2 to be a trigger for Combo3 and its update panel.  The problem is that when I try to add the event from Combo2, I can't find Combo2 listed as a control any longer. I figured it out myself.  Its just a bug in the wizard for the triggers.  If you manually go in and add a trigger using the correct ID and EventName the update works as expected. There's a wizard for setting up triggers? :-) Yeah, when ...

update progress panel, not showning when updating
 hi all,maybe the code before will explain better than i can, and this panel is called by a modalpopup<asp:Panel ID="pn_upload" runat="server" CssClass="modalPopup" Width="330px" Style="display: none"> <cc1:TabContainer ID="upload_container" runat="server" ActiveTabIndex="0"> <cc1:TabPanel ID="upload_tab" runat="server" HeaderText="File Upload"> <HeaderTemplate> File Upload </HeaderTemp...

Ajax Update Panel and Update Progress
Hello Everyone,  Its been long time since i have visited this forum, but i have a query regarding the update panel. I have a strange and weard situtaion here, which is only occuring on the web hosting server and it works absolutely fine on VSS (Local) server. The situation is i have an application where Web User Controls are placed on the web page at the design time, they are made Visible true/false at the run time. The Page where controls are placed contains the update panel and the User controls Indvidually too contains the Update Panel. These update Panel are associated with u...

how to add update progress over the update panel
hi , how do i add the update progress show over the updatepanel. not as a page model dialog.. but just over the associated update panel.thanks in advance Use the AssociatedUpdatePanelD property of UpdateProgress. UpdateProgress will only be visible when updatepanel takes some time to update itself otherwise you will not b able to see UpdateProgress...Best Regards,Waqas You associate an UpdateProgress control with an UpdatePanel control by setting the AssociatedUpdatePanelID property of the UpdateProgress control. When a postback event originates from an Upd...

Automatically start file uploading using FileUpload Control within the Update Panel
Hi all,  I have a FileUpload control within an AJAX Update Panel and I that FileUpload to automatically start uploading file to server as soon as I select the file that I want to upload. I got this code from these forums but t doesn't seem to work probably because I am using FileUpload within UpdatePanel.  <asp:Button ID="Button2" runat="server" OnClick="Button2_Click" Text="Button" /><asp:FileUpload ID="FileUpload1" runat="server" />On Server side Button2.Attributes.add("Style", "Di...

Hiding update panel while update in progress
Dear All,  I want to hide update panel while updating is in progress, I want to notice that my update panel is in content page. If any possiblity of displaying modal loading progress dialogue box while updating it is highly useful. example - Like display appear on clicking "Select Tag button" in "write new post" in our forum Thanks in Advance        Hi,  Try put this into your updatepanel <asp:UpdateProgress ID="UpdateProgress1" runat="server"> <ProgressTemplate>...

Using a hyperlink outside of a update panel to load a different page inside the update panel
I would like to use a hyperlink to access a page to change information inside of a update panel. I remember seeing a video on this, yet I don't remember where. The update panel would load a different page depending on the hyperlink clicked on. The hyperlinks are outside the panel. I wouldn't like to reload the whole page. I don't know what video you saw but...   <asp:UpdatePanel ID="UpdatePanel1" runat="server"> <ContentTemplate> <iframe src="http:\\" runat="server" id="iframe">...

Upload file inside Update Panel without refresh whole page and without using updatepanel triggers for postback trigger
Hi All, Iam using fileupload control inside updatepanel, and save button for save the file uploaded by that fileupload to server by below code: MyFileUpload.SaveAs(Path); So that, my problem i need to perform this code without refresh whole page, so i don't want to use updatepanel triggers for save button to do postback(it referesh whole page _i need only execute  SaveAS Code to Server and all i need to  pass the problem of security issues_(not all page refresh and send to server),  and if the above code don't work if t...

I'm trying to update a GridView by using an Update Panel. Can't get the update to work.
Even when the GridView first loads, none of the new rows that I have added to the database will show up. Any help is appreciated. Thanks.  Code:<asp:ScriptManager ID="ScriptManager1" runat="server" />        <asp:UpdatePanel runat="server" id="UpdatePanel" updatemode="Conditional">        <Triggers>            <asp:AsyncPostBackTrigger controlid="btnRefresh" eventname="Click"...

Two Update Panels and two update progress
So I have master page with Update Panel (with Calendar) and Update Progress.In child page I have rating control in Update Panel and Update Progress.Now when I vote at rating control both of update progress are calling up - I'm angry cause I don't want to call up update progress from calendar. Anyone can help me?  There is a property in UpdateProgress Control named "AssociatedUpdatePanelID". Set this property of both UpdateProgress controls in Master Page and Child page to thier respective update panels and you are good to go.   Don't forget to click &...

Update panels, update progress and browser support
Hi,When I hit a button that must change some things inside the updatepanel, then only that function is executed. Not the page load stuff. This sounds okay to me.(I did this with IE)When I run the same page in Opera browser then it also runs the page load stuff (this means that the update panel - the Atlas functionality - does not work). I also don't see my update progress icon.Can somebody tell me if this is okay?And what is the browser support of Atlas?And finanly, will there be a new version of Atlas in September?Thanks!Please remember to 'Mark as Answer' if this post answ...

Hide the update panel when update progress is displayed
Hopefully this is simple but cant work out how to hide the update panel when event is fired and the update progress is displayed.  E.g. i have simple code below...and displays fine, but when the updateprogress control displays, it just pushes the updatepanel down...can i get it to display instead of the updatepanel? <asp:UpdateProgress ID="UpdateProgressWizard" runat="server" AssociatedUpdatePanelID="UpdatePanelWizard" > <ProgressTemplate> <div align="center"> <uc3:AJAXLoading ID="AJAXLoading1" runat="server" /> </div> </ProgressTemplate> &...