Welcome Guest Search | Active Topics | Sign In | Register

ProgressBar stopped working on upgrade Options
Versile Johnson
Posted: Friday, December 21, 2007 11:20:11 AM
Rank: Advanced Member
Groups: Member

Joined: 8/25/2007
Posts: 34
I recently built a page to use the progress bar while I run extensive server side code. I use a body onload javascript to start the progress bar, which fires the server event ProgressBarRun. At the end of the server event I register a javascript to open a popup window with the PDF and close the current window, when I upgraded to V2 it stopped working! Help!

Code in Page that used to open popup window:

Code: C#
ClientScript.RegisterClientScriptBlock(Page.GetType(), "DL_Script", "DownLoad('../temp/" + session_file + "');", true);
        //Response.TransmitFile(Server.MapPath("~/temp/") + session_file);
        //Response.Write("<script>DownLoad('../temp/" + session_file + "');</script>");
        final_doc.Dispose();


Javascript on .aspx page:

Code: JavaScript
function StartItTask()
{
eo_GetObject('ProgressBar1').startTask();
}
function DownLoad(x)
{
var eo = window.open(x);
win = top;
win.opener = top;
win.close();
}
eo_support
Posted: Friday, December 21, 2007 12:31:42 PM
Rank: Administration
Groups: Administration

Joined: 5/27/2007
Posts: 24,194
Hi Versile,

We would be curious to see how your code has worked on 2007.1. Can you post the Url of the page that works?

Thanks
Versile Johnson
Posted: Friday, December 21, 2007 12:53:20 PM
Rank: Advanced Member
Groups: Member

Joined: 8/25/2007
Posts: 34
sent via PM due to it requires a login.

I reverted to V1 and it works fine, on V2 it doesn't work.

Here's the page aspx:

[deleted by admin]
eo_support
Posted: Friday, December 21, 2007 1:32:28 PM
Rank: Administration
Groups: Administration

Joined: 5/27/2007
Posts: 24,194
Hi Versile,

We looked into the page that works and noticed that the fact it works on 2007.1 was due to an loophole in 2007.1. Nothing else except for e.UpdateProgress is intended to work inside RunTask because RunTask is a very special event. The fact that RegisterClientScriptBlock works but many other server side interfaces do not work inside RunTask confuses user. Thus 2007.2 closed this loophole and no longer support it.

The recommended method to implement such logic is to rely on the second parameter of e.UpdateProgress. With the second parameter you can optionally pass an additional argument to the client side, which you can check inside your ClientOnValueChanged handler and trigger appropriate code accordingly. For example:

Code: C#
//Updating status
for (int i = 0; i < 100; i++)
{
   ....do some work....
   e.UpdateProgress(i);
}

//Now notify the client the result file
e.UpdateProgress(100, "../temp/" + session_file);


Code: HTML/ASPX
<eo:ProgressBar ClientSideOnValueChanged="pb_value_changed" ....>
</eo:ProgressBar>


Code: JavaScript
function pb_value_changed(pb)
{
    var url = pb.getExtraData();
    if (url)
        DownLoad(url);
}


Thanks
Versile Johnson
Posted: Wednesday, December 26, 2007 11:40:05 AM
Rank: Advanced Member
Groups: Member

Joined: 8/25/2007
Posts: 34
fyi this worked like a charm, ty
eo_support
Posted: Wednesday, December 26, 2007 12:46:34 PM
Rank: Administration
Groups: Administration

Joined: 5/27/2007
Posts: 24,194
Cool! Thanks for letting us know!


You cannot post new topics in this forum.
You cannot reply to topics in this forum.
You cannot delete your posts in this forum.
You cannot edit your posts in this forum.
You cannot create polls in this forum.
You cannot vote in polls in this forum.