开发者

UpdateProgress not working with download file

The UpdateProgress is not working with download file. Please see below code, in this code I have used updatepabnel and updateprogress.

On btngen click I'm downloading a excel file.file is downloading but UpdateProgress is not showing. If i will not PostBackTrigger then its not downloading the repot and if PostBackTrigger then its not showing updateprogress. pls suggest how to resolve this issue. i do not want to open a separate popup.

<asp:UpdateProgress ID="prgbar"  runat="server" AssociatedUpdatePanelID="pnl1" DynamicLayout="true">
  <ProgressTemplate>
    <asp:Label id="lblmsg" Text="Please wait while the report generates...." runat="server"></asp:Label>
  </ProgressTemplate>
</asp:UpdateProgress>

<asp:UpdatePanel ID="pnl1" ChildrenAsTriggers="False"  runat="server" UpdateMode="Conditional">
  <ContentTemplate>
  开发者_StackOverflow社区  <asp:Button ID="btngen" Text="Generate" runat="server" onclick="btngen_Click" />
  </ContentTemplate>
  <Triggers>
    <asp:PostBackTrigger ControlID="btngen"  />
  </Triggers> 
</asp:UpdatePanel>


Use javascript to show the Update progress:- use this javascript code code

    var updateProgress = null;

    function postbackButtonClick() {
        updateProgress = $find("<%= prgbar.ClientID %>");
        window.setTimeout("updateProgress.set_visible(true)", updateProgress.get_displayAfter());
        return true;
    }

Add OnClientClick="return postbackButtonClick();"on your btngen Button. Hope this will work.Put the javascript after the Scriptmanager tag.

0

上一篇:

下一篇:

精彩评论

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

最新问答

问答排行榜