2

Background: I have a long-running query on a button click. Hence, updateprogress is invoked to notify user that process is in progress. Currently it is displaying a static data i.e a label.

When the long running process is executed, as expected contents of udapteprogress appears in foreground and freezes the remaining content. i.e.Report generation is in progress, Please do not close the window

Now we would like to show percentage completion i.e. xx% (Ex: 10%) while contents of updateprogress are on foreground

Code: Updateprogress

<asp:UpdateProgress ID="UpdateProgress1" runat="server">
            <ProgressTemplate>
                <div id="progress">
                    <asp:Label ID="lblProgress" Text="Report generation is in progress, Please do not close the window" runat="server"></asp:Label>
                </div>
            </ProgressTemplate>
        </asp:UpdateProgress> 

Updatepanel with button

<asp:UpdatePanel ID="upExport" UpdateMode="Always" runat="server"> 
                                    <ContentTemplate> 
                                        <asp:Button ID="btnExport" runat="server" Text="Export"
                                            OnClick="btnExport_Click" /> 
                                    </ContentTemplate> 
                                    <Triggers> 
                                        <asp:AsyncPostBackTrigger ControlID="btnExport" EventName="Click"/> 
                                    </Triggers> 
                                </asp:UpdatePanel>

Server-side function:

    protected void btnExport_Click(object sender, EventArgs e) 
    { 
    //long running method
}

P.S: while the process is executing btnExport_Click and updateprogress is in foreground, i would want it to display % completion.

In my failed attempt, i tried updating a session variable in 'btnExport_Click' method and access it via javascript but unsuccessful

Update 1: I would like to know a way in which i could communicate % value while i am still in long running method, Coz once control exits from long running method. it would be 100% completion and updateprogress will no longer be on foreground.

Thanks for your time:)

karthikMI2
  • 23
  • 2
  • 7

0 Answers0