I'm using a Progress Area Control to monitor the progess of some code (actually just calling System.Threading.Thread.Sleep(4000)) for right now to simulate code doing stuff. Anyway, it runs fine until it finishes, at which point both the progress bar and the OperationText seem to "reset" back to the first thing I set it to.
For example.
I initially set the PrimaryPercent to 0 and the CurrentOperationText to: "Initialization started...". the last thing I do is set the PrimaryPercent to 100 and the CurrentOperationText to: "Initialization Complete...". It shows this on screen but then seems to reset the PrimaryPercent to 0 and the CurrentOperationText back to: "Initialization started..." before the page response is finished.
Any idea why? I'm setting the progressContext.OperationComplete = True before the final update. Here's my full code:
For example.
I initially set the PrimaryPercent to 0 and the CurrentOperationText to: "Initialization started...". the last thing I do is set the PrimaryPercent to 100 and the CurrentOperationText to: "Initialization Complete...". It shows this on screen but then seems to reset the PrimaryPercent to 0 and the CurrentOperationText back to: "Initialization started..." before the page response is finished.
Any idea why? I'm setting the progressContext.OperationComplete = True before the final update. Here's my full code:
<asp:button runat="server" ID="btnInitialize" Text="Initialize" CssClass="button" /> <telerik:RadProgressManager ID="RadProgressManager1" runat="server" /> <telerik:RadProgressArea ID="rpaInit" Width="100%" ProgressIndicators="TotalProgressBar, CurrentFileName" runat="server" Skin="GCSD" EnableEmbeddedSkins="false"> <ProgressTemplate> <ul class="ruProgress" runat="server"> <li class="ruProgressHeader" runat="server"><span id="ProgressAreaHeader" runat="server"></span></li> <li class="ruFilePortion" runat="server"><div id="PrimaryProgressBarOuterDiv" class="ruBar" runat="server"><div id="PrimaryProgressBarInnerDiv" runat="server"></div></div></li> <li class="ruCurrentFile width100Percent" runat="server"><span class="lblCurrentOperationTitle">Status:</span><asp:label runat="server" id="CurrentOperation" class="lblCurrentOperation" /></li> </ul> </ProgressTemplate> <Localization Uploaded="Uploaded"></Localization> </telerik:RadProgressArea>Private Sub UpdateProgressMessage(ByVal progressContext As Telerik.Web.UI.RadProgressContext, ByVal strMessage As String, ByVal intPercentComplete As Integer) Dim strScript As String Dim writer As New StringWriter progressContext.PrimaryPercent = intPercentComplete progressContext.CurrentOperationText = String.Format("{0}", strMessage) progressContext.Serialize(writer) strScript = String.Format("{1};Sys.Application.add_load(function(){{$find(""{0}"").update(rawProgressData);}});", rpaInit.ClientID, writer.GetStringBuilder().ToString()) ClientScript.RegisterStartupScript(Me.[GetType](), "", strScript, True) End Sub Private Sub btnInitialize_Click(ByVal sender As Object, ByVal e As System.EventArgs) Handles btnInitialize.Click Dim progressContext As RadProgressContext = RadProgressContext.Current rpaInit.DisplayCancelButton = False UpdateProgressMessage(progressContext, "Initialization started...", 0) System.Threading.Thread.Sleep(2000) 'delay it a couple seconds UpdateProgressMessage(progressContext, "Loading Stuff...", 25) System.Threading.Thread.Sleep(4000) UpdateProgressMessage(progressContext, "Loading More Stuff...", 50) System.Threading.Thread.Sleep(5000) UpdateProgressMessage(progressContext, "Loading Even More Stuff...", 75) System.Threading.Thread.Sleep(5000) progressContext.OperationComplete = True UpdateProgressMessage(progressContext, "Initialization Complete", 100) End Sub