.net progress bar in a asp.net we application
Is it possible to have a .net progress bar in a asp.net web application.
I tried doing this:
ProgressBar pb = new ProgressBar();
pb.Name = "pb";
pb.Value = 30;
pb.MarqueeAnimationSpeed = 30;
pb.Location = new System.Drawing.Point(20, 20);
pb.Width = 200;
pb.Height = 30;
Controls.Add(pb);
but this :
Controls.Add(pb);
Doesnt work,
Any idea how to do this? or so开发者_开发知识库mething the same?
Thanks
no this is not possible - ASP.NET pages are just rendered HTML that gets send to the client (web-browser). The progress-bar is a client-side control.
If you need something like this on the client you may to use Javascript/JQuery/AJAX or something similar.
Here is a version for JQuery And here is a nice article on this with AJAX
You can't use this control on web.
To make it work you need to write an algorithm(maybe using an async call) to update the progress bar.it won't work if you use the classic request/response because you would not have the chance to update your progress bar. you need a way to read a kind of value at regular interval to update the progress bar and give the perception to the users that something is happening. If you want to go for a "fake" one you could use the one showed at the link below:
http://jqueryui.com/demos/progressbar/
精彩评论