RadProgressArea not displaying in IE

Thread is closed for posting
3 posts, 0 answers
  1. Wayne Keet
    Wayne Keet avatar
    4 posts
    Member since:
    May 2010

    Posted 08 Oct 2010 Link to this post

    Hi,

    I am struggling a bit to get a progress area from being displayed in IE. Basically I am calling a WebMethod from the JavaScript and the WebMethod is updating the ProgressArea. Here is an example of my code:

    Javascript:

    function IsLongRunningTaskCompleted(){
                
                var lParams = GetPageMethodArguments();
                var lLocation = window.location.href;
                var lLocationToSubstringIndex = lLocation.search(".aspx?") + 5;
                lLocation = lLocation.substr(0, lLocationToSubstringIndex);
               
                $.ajax({
                    type    : "POST",
                    url     : lLocation + "/" + "ExecuteLongRunningTask",
                    data    : "{" + lParams + "}",
                    contentType : "application/json; charset=utf-8",
                    dataType    : "json",
                    success : function (pCurrentAction)
                                {
                                    if (pCurrentAction.d == "Completed") CloseCurrentAspxPage();
                                    window.setTimeout("IsLongRunningTaskCompleted()", 100);
                                },
                    fail : function (pCurrentAction)
                                {
                                        CloseCurrentAspxPage();
                                }
                    });
                }
            }

    Server side :

    public class DoStuff
    {
            private static RadProgressContext FProgressArea;
            private static double FCurrentPrecentage ;

            protected void Page_Load(object sender, EventArgs e)
            {
                 FProgressArea = RadProgressContext.Current;
                 FCurrentPrecentage  = 0.0;
            }

            private delegate int ExecuteTimeConsumingProcessProcess();

            [WebMethod]
            public static string ExecuteLongRunningTask()
            {
               
                if (String.IsNullOrEmpty(FCurrentDuplicateStatus))
                {
                    
                    var lWriteInfoToDb = new WriteInfoToDB();
                    var lSavingStuff = new ExecuteTimeConsumingProcessProcess(lWriteInfoToDb.SaveALotOfData);

                    IAsyncResult lResult = lSavingStuff .BeginInvoke(null, null);

                    while (!lResult.IsCompleted)
                    {
                        FCurrentPrecentage = lSavingStuff.PercentageCompleted;
                        UpdateProgressBar(FProgressArea, FCurrentPrecentage );
                        Thread.Sleep(100);
                    }

                    lSavingStuff .EndInvoke(lResult);
                    FCurrentStatus = "Completed";
                }

                return FCurrentStatus ;
            }

            private static void UpdateProgressBar(RadProgressContext pProgressArea, double pPercentageCompleted)
            {
                const int cTotal = 100;

                pProgressArea.Speed = "N/A";
                pProgressArea.PrimaryTotal = 1;
                pProgressArea.PrimaryValue = 1;
                pProgressArea.PrimaryPercent = 100;

                pProgressArea.SecondaryTotal = cTotal;
                pProgressArea.SecondaryPercent = pPercentageCompleted;
                pProgressArea.CurrentOperationText = "Step " + pPercentageCompleted;
                Thread.Sleep(100);
            }
    }

    In Firefox this is working perfectly well, but in IE I am not getting a progress area, and the page request times out. Have you got any idea what I am doing wrong by looking at the code? Or do you have any tips?

    Thanks in advance.
  2. Wayne Keet
    Wayne Keet avatar
    4 posts
    Member since:
    May 2010

    Posted 08 Oct 2010 Link to this post

    Nevermind, I think I got it to work. I think there was something wrong in my jquery.

    Thanks
  3. UI for ASP.NET Ajax is Ready for VS 2017
  4. Wayne Keet
    Wayne Keet avatar
    4 posts
    Member since:
    May 2010

    Posted 08 Oct 2010 Link to this post

    It turned  out not to be a jquery issue, but more like an issue where IE required to take a breather in order for it to display the propgresscontext. So in order to get it to work I did the following:

    Created another javascript function that calls a new webmethod that updates the propgresscontext and returns a string to my javascript to give it a go ahead to call "IsLongRunningTaskCompleted" javascript as showed earlier. It seems like this gave IE enough time to render or display the progress area.

    This is not an ideal solution I guess, but it worked for me. I guess a better way of doing this would have been to update the progress area on the client side, rather let the webmethod return the percentageand update the progress area on the client side with the percentage completed. However in my case it would not have been possible, since I have a few asynchronous calls down several layers in the code that prevents me from going back to the client side often enough to make the update on the client side.
Back to Top