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

Hide RadProgressArea after Response.End()

2 Answers 102 Views
Upload (Obsolete)
This is a migrated thread and some comments may be shown as answers.
raskarov
Top achievements
Rank 1
raskarov asked on 17 May 2012, 01:07 AM
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 Answers, 1 is accepted

Sort by
0
raskarov
Top achievements
Rank 1
answered on 22 May 2012, 08:18 PM
Anyone?
0
Plamen
Telerik team
answered on 28 May 2012, 08:48 AM
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.
Tags
Upload (Obsolete)
Asked by
raskarov
Top achievements
Rank 1
Answers by
raskarov
Top achievements
Rank 1
Plamen
Telerik team
Share this question
or