Welcome Guest Search | Active Topics | Sign In | Register

Show/Hide progress bar Options
Sujata
Posted: Thursday, July 10, 2008 9:42:12 AM
Rank: Newbie
Groups: Member

Joined: 7/2/2008
Posts: 7
Te EO controls are really worth using. I am using 2 progress bars for 2 different tasks on a single page. Is there any way I can show/hide the respective progress bars? The normal way as "ProgressBar1.Visible=fa;se" does not work. I tried some javascript also but that didn't work.
Any idea about it?

Thanks for the help.
eo_support
Posted: Thursday, July 10, 2008 10:09:18 AM
Rank: Administration
Groups: Administration

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

You won't be able to do that. You will need to place the ProgressBar inside a DHTML element and then show/hide that element with JavaScript. For example:

<div id="div1">
progress bar goes here....
</div>

//Hide it
document.getElementById("div").style.display = "none";

Thanks
Sujata
Posted: Friday, July 11, 2008 12:24:29 AM
Rank: Newbie
Groups: Member

Joined: 7/2/2008
Posts: 7
Actually, I am using the progress bar on a asp.net page. The button which causes the starting of progress bar is a "<asp:Button>" control. I have already tried hiding the div as you told in your reply, but it just does not work.
I have tried 2 ways
1. writing the javascript directly on the button click as onclick="document.getElementById("div").style.display = "none";" This does not work.
2. I have also tried appending the javascript at server-side as Button1.Attributes.Add("onclick","document.getElementById("div").style.display = "none";");
But this does not get added as it is supposed to be, in the source of running page the ASP.Net button control renders with onclick=return false;.

Thanks for any help.
eo_support
Posted: Friday, July 11, 2008 7:19:47 AM
Rank: Administration
Groups: Administration

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

Try NOT to use a standard ASP.NET button. You would do:

Code: HTML/ASPX
<input type="button" value="Start" onclick="start_progress_bar()" />


Code: JavaScript
function start_progress_bar()
{
    //Hide whatever you want to hide
    document.getElementById("div").style.display = "none";

    //Get the progress bar object
    var pb = eo_GetObject("your_progress_bar_id");

    //Start the progress bar
    pb.startTask();
}


Note you will need to clear the ProgressBar's StartButton property. That last two lines of JavaScript is what StartButton does.

Thanks
Mikael Lehmann
Posted: Friday, July 11, 2008 8:02:03 AM
Rank: Member
Groups: Member

Joined: 6/17/2007
Posts: 17
Hi,
I'm having the same problem and referring to your last answer, how do i use the onclick event if i already use it for code behind? Is it possible to use two onclick events at the same time? One for "Button1_Click" (Code Behind) and another for "start_progress_bar"?

Thanks
Sujata
Posted: Friday, July 11, 2008 8:26:11 AM
Rank: Newbie
Groups: Member

Joined: 7/2/2008
Posts: 7
Hoorey!!! I got my problem resolved due to the answer from eo_support, Thank you very much.

Mikael, I am not sure for what purpose you want the 2 click events on the same button. What I have done is writing all the code of "Button1_Click" event in the ProgressBar's runtask event and adding the "start_progress_bar" as suggested by eo_support in previous reply. And it works !!!.
eo_support
Posted: Friday, July 11, 2008 8:42:44 AM
Rank: Administration
Groups: Administration

Joined: 5/27/2007
Posts: 24,193
Mikael Lehmann wrote:
how do i use the onclick event if i already use it for code behind? Is it possible to use two onclick events at the same time


Hi,

You suppose to be able to do:

Button1.Attribuates["onclick"] = "something();";

And ASP.NET does take that and put it in the rendered HTML code. However the problem can arise when ASP.NET itself also sometimes generates onclick handler (in order to support validation groups, etc). ASP.NET tries to put them together but you are pretty much at the mercy of ASP.NET on that. The fact that AJAX solution and so many other solutions out there nowadays that intercept button clicks are so popular these days does not help that. Again, everyone supposes to keep your original onclick handler but if anyone in the chain misses, you get in trouble. So the solution does work in theory, but in practice, it might cost you sometime to troubleshoot if you get into a problem.

Sujata's case is easier because he does not need both client side and server side to work at the same time. In that case doing it on client side is generally easier.

Thanks


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.