Ajax callback error when using Custom Progress

Thread is closed for posting
4 posts, 0 answers
  1. Charlie Bross
    Charlie Bross avatar
    16 posts
    Member since:
    Jul 2008

    Posted 30 Oct 2008 Link to this post

    I am using the RadUpdate/ProgressArea control to allow a user to upload a file and then view the status of the import process. The first progress bar is handled automatically during the update process by the progress area. The second part of the process, the import, I am using the secondary progress bar to give them feedback (processing line x of y).

    ************* ERROR MESSAGE *****************

    RadUpload Ajax callback error. Source url returned invalid content:

    var rawProgressData = {InProgress:true,ProgressCounters:true,PrimaryPercent:'100'System.InvalidOperationException: Collection was modified; enumeration operation may not execute.

       at System.ThrowHelper.ThrowInvalidOperationException(ExceptionResource resource)
       at System.Collections.Generic.Dictionary`2.KeyCollection.Enumerator.MoveNext()
       at Telerik.Web.UI.Upload.ProgressData.Serialize(TextWriter writer)
       at Telerik.Web.UI.RadProgressContext.Serialize(TextWriter writer)
       at Telerik.Web.UI.RadUploadProgressHandler.ProcessRequest(HttpContext context)


    Did you register the RadUploadProgressHandler in web.config?

    Please, see the help for more details: RadUpload for ASP.NET Ajax - Configuration - RadUploadProgressHandler.

    ***************** End of Error ******************

    Any ideas what is causing this?


    **************** Sample Code ********************
    UploadedFile file = UploadedFile.FromHttpPostedFile(Request.Files[0]);

    string fileName = MapPath("uploads") + "\\" + file.GetName();

    file.SaveAs(fileName, true);

    if (!Object.Equals(file, null))

     private void importFile(string fileName)
            ArrayList lines = new ArrayList();

            RadProgressContext progress = RadProgressContext.Current;
            DateTime startTime = DateTime.Now;

            progress.SecondaryTotal = 100;
            progress.SecondaryValue = 0;
            progress.SecondaryPercent = 0;
            progress.CurrentOperationText = "Reading File..";

            StreamReader reader = new StreamReader(fileName);

                int totalLines = 0;

                while (!reader.EndOfStream)
                progress.SecondaryTotal = totalLines;
                progress.CurrentOperationText = "Importing Data...";

                for (int line = 0; line < totalLines; line++)
                        //progressContext.PrimaryPercent = (int)Math.Round(((decimal)i / count) * 100, 0);
                        progress.SecondaryValue = line;
                        progress.CurrentOperationText = "Importing Data...(" + line + " of " + totalLines + ")";

                    TimeSpan elapsed = DateTime.Now.Subtract(startTime);
                    progress.TimeElapsed = string.Format("{0:D2}:{1:D2}:{2:D2} s", elapsed.Hours, elapsed.Minutes, elapsed.Seconds);

                    double estimatedMillisecons = 24 * 60 * 60 * 1000;
                    if (line != 0)
                        estimatedMillisecons = totalLines * elapsed.TotalMilliseconds / line;
                    TimeSpan estimated = TimeSpan.FromSeconds(1);
                    if (estimatedMillisecons > 1)
                        estimated = TimeSpan.FromMilliseconds(estimatedMillisecons);
                    progress.TimeEstimated = string.Format("{0:D2}:{1:D2}:{2:D2} s", estimated.Hours, estimated.Minutes, estimated.Seconds);

                    double speed = 0.0d;
                    if (elapsed.TotalSeconds > 0)
                        speed = line / elapsed.TotalSeconds;
                    progress.Speed = string.Format("{0:0.00} steps/s", speed);

                    if (!Response.IsClientConnected)
                        //Cancel button was clicked or the browser was closed, so stop processing
            catch (Exception ex)
                App.ProcessException(this, ex);
                throw ex;
                if (reader != null)

  2. Erjan Gavalji
    Erjan Gavalji avatar
    1455 posts

    Posted 02 Nov 2008 Link to this post

    Hi Charlie,

    Thanks for reporting that! Indeed, the error message is a small bug in the serialization of the RadProgressContext object. The bug will be fixed for the official Q3 2008 release of the RadControls for ASP.NET Ajax suite, scheduled for the end of the next week.

    Please, bear with us some more.

    P.S. Your Telerik account was updated accordingly.

    Best regards,
    Erjan Gavalji
    the Telerik team

    Check out Telerik Trainer, the state of the art learning tool for Telerik products.
  3. yonigibbs
    yonigibbs avatar
    3 posts
    Member since:
    Nov 2006

    Posted 18 Mar 2016 in reply to Erjan Gavalji Link to this post


    Is the fix for this still available?  A customer of ours is having exactly the same problem, and our software uses the Telerik controls from 2006.



  4. Hristo Valyavicharski
    Hristo Valyavicharski avatar
    975 posts

    Posted 23 Mar 2016 Link to this post

    Hi Yoni,

    You will have to use newer version. We recommend that you upgrade to the latest.

    Hristo Valyavicharski
    Do you need help with upgrading your ASP.NET AJAX, WPF or WinForms projects? Check the Telerik API Analyzer and share your thoughts.
Back to Top