ASP.NET 应用程序中的 .net 进度条
是否可以在 ASP.NET Web 应用程序中拥有 .NET 进度条。
我尝试这样做:
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);
但这:
Controls.Add(pb);
不起作用,
知道如何做到这一点吗?或相同的东西?
谢谢
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 something the same?
Thanks
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。
绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(3)
不,这是不可能的 - ASP.NET 页面只是呈现 HTML,然后发送到客户端(Web 浏览器)。进度条是客户端控件。
如果您在客户端需要类似的东西,您可以使用 Javascript/JQuery/AJAX 或类似的东西。
这是 JQuery 的版本
这是一篇关于 AJAX 的很好的 文章
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.
要使其工作,您需要编写一个算法(可能使用异步调用)来更新进度栏。如果您使用经典的请求/响应,它将无法工作,因为您将没有机会更新进度栏。您需要一种定期读取某种值的方法来更新进度条并向用户传达正在发生的事情的感觉。如果您想要一个“假”的,您可以使用下面链接中显示的一个:
http:// jqueryui.com/demos/progressbar/
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/