Click here to Skip to main content
15,902,299 members
Please Sign up or sign in to vote.
0.00/5 (No votes)
See more:
Hi,

I am facing this issue for quite some time. I am not able to use updateprogress properly with fileupload control. My design page code is :
<asp:ScriptManager ID="scriptMgr" runat="server" />
  <asp:UpdateProgress runat="server" id="PageUpdateProgress">
            <progresstemplate>
                Loading...<img border="0" src="Images/loading.gif" alt="loading" style="z-index: 1100;" />
            </progresstemplate>
        <asp:UpdatePanel ID="updatePnl" runat="server" UpdateMode="Conditional" >
        <contenttemplate>
    <table cellpadding="0" cellspacing="0" width="800px" border="0" align="center" class="description">
        <tr>
            <td width="70%">
                &lt;asp:FileUpload Width="250px" CssClass="field" ID="fileUploadText" runat="server" /&gt;
            </td>
        </tr>
        <tr class="alt">
            <td valign="top" colspan="2">
                <table width="100%" border="0" cellspacing="0" cellpadding="2">
                    <tr>
                        <td width="60%" align="right">
                            &lt;asp:Button ID="btnSubmit" runat="server" Text="Submit"
                                CssClass="button" onclick="btnSubmit_Click" OnClientClick="ShowProgress();"/&gt;
                            </td>
                    </tr>
                </table>
            </td>
        </tr>
</table>
</contenttemplate>
    <triggers>
     <asp:PostBackTrigger ControlID="btnSubmit"/>
     </triggers>

and my .cs code is :
C#
protected void btnSubmit_Click(object sender, EventArgs e)
    {
        string filePath = Server.MapPath("Input File/" + fileUploadText.FileName);
        fileUploadText.PostedFile.SaveAs(filePath);
        System.Threading.Thread.Sleep(5000);
    }

The above code works fine but .gif image does not rotate. When I remove trigger tag and fileUpload control then the image starts rotating. What is the reason for this and how can i resolve?
Posted
Updated 6-Dec-10 8:02am
v3

Well, the problem is, while you are uploading the file the upload is synchronous (Postback) and hence the whole page is refreshed during the upload.

I would recommend you to load the FileUpload inside an IFrame and do the postback from within the IFrame.
 
Share this answer
 
Comments
Pranav Thakur 6-Dec-10 23:00pm    
After putting Fileupload inside iframe, i do not see the .gif image rotating.
After putting Fileupload inside iframe, i do not see the .gif image rotating
 
Share this answer
 
Hi,
As your trigger is raising Postback event which refreshes your page , hence not showing up the update progress .
To prevent your page from complete postback use iframe or some ajax based upload control like
ajaxuploader

Hope this helps !!!!
 
Share this answer
 
v2

This content, along with any associated source code and files, is licensed under The Code Project Open License (CPOL)



CodeProject, 20 Bay Street, 11th Floor Toronto, Ontario, Canada M5J 2N8 +1 (416) 849-8900