开发者

Update Progress not seen

I have a utility which uploads a file and then process it and saves it. So I have a file upload control, a btn to upload and a cancel btn with couple of labels to display messages.

Problem: I cant see the update progress when I hit btnupload or btncancel. Here is the code.

<asp:UpdatePanel ID="UpdatePanel1" runat="server">
<ContentTemplate>
<asp:Label ID="lblerrormsg" runat="server" class="lblerrormsg"></asp:Label>
</ContentTemplate> 
</asp:UpdatePanel>

<asp:Label ID="lblsource" runat="server" class="lblleft" Text="Select file ">   
</asp:Label>
<asp:FileUploa开发者_如何学Cd ID="FileUploadSource" runat="server" class="BtnUpload" />
<asp:Button ID="btnCancel" runat="server" Text="Cancel" class="btnRefresh"    
OnClientClick="ClearFileUpload()"                                                   
CssClass="btnRefresh" OnClick="btnCancel_Click" />
<asp:Button ID="btnUnlock" runat="server" Text="Process File"       
class="btnRefresh" OnClick="btnUnlock_Click"  CssClass="btnRefresh" /> 
<asp:UpdatePanel ID="UpdatePanel2" runat="server">
<ContentTemplate>
<asp:UpdateProgress ID="UpdateProgress1" runat="server" DisplayAfter="100" 
AssociatedUpdatePanelID="UpdatePanel2" >
<ProgressTemplate>
<img alt="Loading" src="Images/updateprogress.gif"   />
</ProgressTemplate>
</asp:UpdateProgress>
<asp:Label ID="lblSaved" runat="server" class="lblleft"></asp:Label><br/>
<asp:Label ID="lblsourcePath" runat="server" class="lblleft"></asp:Label>
</ContentTemplate> 
</asp:UpdatePanel>

<asp:UpdatePanel ID="UpdatePanel1" runat="server">
<ContentTemplate>
<asp:Label ID="lblerrormsg" runat="server" class="lblerrormsg"></asp:Label>
</ContentTemplate> 
</asp:UpdatePanel>`

Please help. Thanks Chand


Eliminate AssociatedUpdatePanelID and try since it's inside the UpdatePanel I don't think you need it.


My suspicion is because an asp.net file upload is not an asynchronous event and asp.net Ajax gets blocked whilst the upload is in progress.

The only way i've solved this in the past is to write my own uploader that sends the file through an iframe, and a custom handler on the server that reflects the posted file out of the underlying http request so you can save it as a stream whilst alerting the client of it's progress.

The reason for that is any attempt to read the request normally causes the whole file to be loaded into memory.


The Button and the UpdateProgress controls both need to be in an update panel, or you need to take the UpdateProgress control out of the UpdatePanel.

0

上一篇:

下一篇:

精彩评论

暂无评论...
验证码 换一张
取 消

最新问答

问答排行榜