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

Hide RadProgressArea after Response.End()

2 Answers 221 Views
ProgressArea
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 | edited on 30 May 2023, 08:51 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 shown 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.
Fit2Page
Top achievements
Rank 2
Iron
Iron
Iron
commented on 16 May 2023, 06:40 AM

Hi there,

 

Is this answer still applicable? I tried this but to no avail. Also the link to the help topic is not working anymore.

 

BR,

Marc

Rumen
Telerik team
commented on 30 May 2023, 08:50 AM

Hi Marc, yes, you can use the OnClientProgressUpdating event to hide the progress area on the client-side. You can also try the hide method of the RadProgressArea Client Object.
Tags
ProgressArea
Asked by
raskarov
Top achievements
Rank 1
Answers by
raskarov
Top achievements
Rank 1
Plamen
Telerik team
Share this question
or