This is a migrated thread and some comments may be shown as answers.

Progress Area resets when complete Issue

6 Answers 99 Views
Upload (Obsolete)
This is a migrated thread and some comments may be shown as answers.
Paul J
Top achievements
Rank 1
Paul J asked on 13 Dec 2010, 08:11 PM
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:

<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

6 Answers, 1 is accepted

Sort by
0
Genady Sergeev
Telerik team
answered on 15 Dec 2010, 04:31 PM
Hi Paul J,

Is your RadProgressManager inside of RadAjaxPanel/UpdatePanel or ajaxified using RadAjaxManager? If so, move it out of the ajax area and try again. Does the issue persist?

Kind regards,
Genady Sergeev
the Telerik team
Browse the vast support resources we have to jump start your development with RadControls for ASP.NET AJAX. See how to integrate our AJAX controls seamlessly in SharePoint 2007/2010 visiting our common SharePoint portal.
0
Paul J
Top achievements
Rank 1
answered on 15 Dec 2010, 04:35 PM
No, it is not inside of any kind of UpdatePanel nor RadAjaxPanel. Nor is it ajaxified using the RadAjaxManager.
0
Accepted
Genady Sergeev
Telerik team
answered on 20 Dec 2010, 02:30 PM
Hello Paul J,

I've already answered to you in the support thread, however, I will paste the answer here as well for a community reference. In order to achieve the desired functionality please do the following:

1) Remove the following from your code, you don't need it

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)

2) Place the RadProgressManager and the the Initialize button inside a RadAjaxPanel while keeping the RadProgressArea outside of it.

All the best,
Genady Sergeev
the Telerik team
Browse the vast support resources we have to jump start your development with RadControls for ASP.NET AJAX. See how to integrate our AJAX controls seamlessly in SharePoint 2007/2010 visiting our common SharePoint portal.
0
Paul J
Top achievements
Rank 1
answered on 29 Dec 2010, 04:28 PM
Thanks for the info. I did as you suggested, but as soon as I add in the RadAjaxPanel control, it gives me a 'Sys' is undefined error when the page loads. If I take it away, then the page loads fine.  I've read through the telerik blog post about the generic 'Sys' is undefined, but still could not resolve my issue. I had already had many other telerik controls on the page and they were fine, but again, once adding the specific RadAjaxPanel control, it throws that error.

any ideas?
0
Genady Sergeev
Telerik team
answered on 03 Jan 2011, 03:05 PM
Hello Paul J,

You can try with UpdatePanel as well. Does the issue persist? If so, please attach here your aspx code so that we can take a look.

Regards,
Genady Sergeev
the Telerik team
Browse the vast support resources we have to jump start your development with RadControls for ASP.NET AJAX. See how to integrate our AJAX controls seamlessly in SharePoint 2007/2010 visiting our common SharePoint portal.
0
Paul J
Top achievements
Rank 1
answered on 03 Jan 2011, 03:23 PM
No need, I was able to isolate my issue.

Your attached sample project greatly helped me to isolate the code line that was giving me the errors. I had a simple line in the aspx file that pulls a variable value from the appSettings section of the web.config file, and this was causing these errors after I had added the radAajaxPanel to the page. I honestly am not sure why the two conflict and cause these errors, but I easily adjusted to set a literal control's value to the webconfig's variable in the codebehind.

Thanks again.
Tags
Upload (Obsolete)
Asked by
Paul J
Top achievements
Rank 1
Answers by
Genady Sergeev
Telerik team
Paul J
Top achievements
Rank 1
Share this question
or