Hide RadProgressArea after Response.End()

Thread is closed for posting
3 posts, 0 answers
  1. raskarov
    raskarov avatar
    8 posts
    Member since:
    Jul 2011

    Posted 16 May 2012 Link to this post

    Hi,
    I'm trying to use RadProgressArea to monitor custom progress.Everything works good, but the last part of my method is to return file to a user for a download. I do this through writing stream to a response and ending it with Response.End(). Something like this: 

    RadProgressContext progress = RadProgressContext.Current;
            progress.SecondaryValue = 1;
            progress.SecondaryPercent = 1;
            progress.SecondaryTotal = 100;
     
            System.Threading.Thread.Sleep(3000);
            progress.SecondaryValue = 50;
            progress.SecondaryPercent = 50;
            System.Threading.Thread.Sleep(3000);

            //testing response
            byte[] b = File.ReadAllBytes("c:\\image1.jpg");
            Context.Response.ContentType = "image/jpg";
            Response.AddHeader("content-disposition", "attachment; filename=image.jpg");
            Response.BinaryWrite(b);
            Response.End();


    It works great except RadProgressArea is not hidden after method is complete. I guess this happens because of the abruption of the response stream, because it hides if I do not have last 5 lines of code.
    Is there any workaround of this issue?

    Thanks. 
  2. raskarov
    raskarov avatar
    8 posts
    Member since:
    Jul 2011

    Posted 22 May 2012 Link to this post

    Anyone?
  3. UI for ASP.NET Ajax is Ready for VS 2017
  4. Plamen
    Admin
    Plamen avatar
    2734 posts

    Posted 28 May 2012 Link to this post

    Hello Ruslan,

     
    In such scenarios instead of working on the server we recommend using the client event and canceling the OnClientProgressUpdating as it is show in this help topic of by invoking the cancel button click as in the code below:

    function OnClientProgressUpdating(sender, args) {
               var prog = $find("<%=RadProgressArea1.ClientID %>");
               prog.cancelClicked = true;
     
     
           }

    Hope this will be helpful.

    Regards,
    Plamen Zdravkov
    the Telerik team
    If you want to get updates on new releases, tips and tricks and sneak peeks at our product labs directly from the developers working on the RadControls for ASP.NET AJAX, subscribe to their blog feed now.
Back to Top