Welcome Guest Search | Active Topics | Sign In | Register

EO Progressbar question Options
rodymus
Posted: Tuesday, March 18, 2008 7:11:08 PM
Rank: Newbie
Groups: Member

Joined: 3/18/2008
Posts: 3
Hi there, i'm am new with eo progressbar, below is the code

"
private void ProgressBar1_RunTask(object sender, EO.Web.ProgressTaskEventArgs e)
{
try
{
if(FileUpload.PostedFile.FileName!="")
{
lblFile.Visible = false;
string sSQL = "exec msdb..sp_help_job @job_name = 'LPM_SPM', @job_aspect = N'job'";
DataTable dtObj = new APK.GlobalJob().ExecuteSQL(sSQL);

if (dtObj.Rows.Count>0)
{
int iStatus = int.Parse(dtObj.Rows[0]["current_execution_status"].ToString());
if (iStatus==4)
{
this.ProceedFile();
Global.SetPosition(this.trConfigure);
Entity.SYS.enTbSYS_m_FIKYear enObj = new Entity.SYS.enTbSYS_m_FIKYear();
enObj.sFIKYear = txtYear.Text;
DataTable dtYear = new DataAccess.SYS.daTbSYS_m_FIKYear().SelectByID(enObj);
if (dtYear.Rows.Count>0)
{
this.trProcess.Visible = true;
this.trUpload.Visible = false;
}
else
{
e.UpdateProgress(0, "Running...");
for (int i = 0; i < 100; i++)
{
if (e.IsStopped)
break;

this.RunningJob();

e.UpdateProgress(i);
}

e.UpdateProgress(100, "The task is done!");
}
}
else
throw new Exception("Penjanaan sedang dalam proses..");
}
else
throw new Exception("Nama 'job' LPM_SPM tidak dijumpai! Sila hubungi Pentadbir Sistem");

}
else
lblFile.Visible = true;
}
catch(Exception ex)
{
AppError.BoxErrorTech(this.Page,ex);
}

}
"

When its come to "lblFile.Visible = true;" or "this.trProcess.Visible = true;", the label is still not visible. Seems like the ProgressBar1_RunTask not invoke this code. How to make it works?
eo_support
Posted: Tuesday, March 18, 2008 7:20:46 PM
Rank: Administration
Groups: Administration

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

RunTask is a very special event. The only thing you can update inside it is the progress bar. No other part of the page is updated (It has to be that way otherwise you will see the whole page refreshing).

While updating from the server side is ruled out, you can still do it on the client side. The "Server Task" sample actually shows you how to do it:

http://www.essentialobjects.com/Demo/Default.aspx?path=ProgressBar\_i2

Check the comment and you will see how it works. The full source code is on your local disk if you have installed our product.

Thanks
rodymus
Posted: Tuesday, March 18, 2008 7:26:50 PM
Rank: Newbie
Groups: Member

Joined: 3/18/2008
Posts: 3
Hi eo_support,
Thanks for fast reply,
my 2nd question is how to call the runtask function in other function in c#. Your help is really2 appreciated. Thanks.
eo_support
Posted: Tuesday, March 18, 2008 7:38:24 PM
Rank: Administration
Groups: Administration

Joined: 5/27/2007
Posts: 24,194
You don't. You trigger the progress bar and let the progress bar does it.

RunTask needs to access e.UpdateProgress (you can write a function that does not call it, but it won't move the progress bar for you so it will be useless). And e.UpdateProgress is not available anywhere else except inside RunTask event. That's why you can never call runtask from outside.

To trigger the progress bar programmatically, render the following JavaScript code:

ProgressBar1.startTask();

For example, you can put the following code in your .aspx:

<asp:Panel runat="server" id="panStartProgressBar" Visible="False">
<script type="text/javascript>
ProgressBar1.startTask();
</script>
</asp:Panel>

To trigger the progress bar, set panStartProgressBar's Visible to true. You will need to change "ProgressBar1" to the real ID of the ProgressBar, if you get an error, replace ProgressBar1 with eo_GetObject("ProgressBar1"). Also make sure the code block is placed after the ProgressBar in your page as you can't start the ProgressBar before it is even created.

Thanks
rodymus
Posted: Tuesday, March 18, 2008 8:13:49 PM
Rank: Newbie
Groups: Member

Joined: 3/18/2008
Posts: 3
Ok. thanks a lot.
Can u provide sample code for "While updating from the server side is ruled out, you can still do it on the client side"? What u mean by that?
eo_support
Posted: Tuesday, March 18, 2008 8:21:23 PM
Rank: Administration
Groups: Administration

Joined: 5/27/2007
Posts: 24,194
We have already provided that to you:

Quote:
The "Server Task" sample actually shows you how to do it:

http://www.essentialobjects.com/Demo/Default.aspx?path=ProgressBar\_i2

Check the comment and you will see how it works. The full source code is on your local disk if you have installed our product.

eo_support
Posted: Tuesday, March 18, 2008 9:59:46 PM
Rank: Administration
Groups: Administration

Joined: 5/27/2007
Posts: 24,194
Your last post has been deleted. Please see your private message for why. You can access the private message from the "inbox" link at the top of the page.


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.