GridView ASP.Net 中需要进度条

发布于 2024-08-18 19:40:18 字数 388 浏览 2 评论 0原文

请看一下这张图片 显示待处理工作的网格 http://softwaregenius.net/myimages/grid.png

该图像显示在 ASPX 页面 (.net 2.0) 上包含一些列的 gridview。获取所有库存列表后,我必须创建发票,然后将这些发票转换为 PDF。我想要的是状态栏中的进度条。我不想显示“待处理”或“已完成”状态,而是想显示一个进度条来突出显示发票和 pdf 创建的过程。

你知道我该怎么做吗?如果您仍然不明白,请考虑在 Orkut 中上传图像页面,该页面会在上传图像时显示进度条。

感谢您分享您的宝贵时间...

Please have a look at this image
Grid Showing Pending Work http://softwaregenius.net/myimages/grid.png

The image shows a gridview with some columns on an ASPX page (.net 2.0). Here after getting the list of all stocks, i have to create invoices and then to convert those invoices into PDF. What i want is a progress bar in Status column. Rather than showing Pending or Completed status I want to show a progress bar to highlight the process of invoice and pdf creation.

Do you have any idea, how i can do that. If you still not understand then consider uploading images page in Orkut, that shows progressbar as the image is uploaded.

Thanks for sharing your valuable time...

如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。

扫码二维码加入Web技术交流群

发布评论

需要 登录 才能够评论, 你可以免费 注册 一个本站的账号。

评论(4

差↓一点笑了 2024-08-25 19:40:18

要显示实际进度,您需要从服务器获取状态并更新客户端的 UI。一种方法是将 HTTP 处理程序和 AJAX 与 jQuery 结合使用。

1.启动发票创建

$("#btnCreateInvoice").click(function() {             
       $.ajax({ type: "POST",  url: "YourHttpHandler.ashx",
       contentType: "text/html; charset=utf-8",
       dataType: "html",  
       success: function(data) { UpdateStatus-Initialize some progressbar plugin }
       });
    });

2。轮询

接下来您需要做的是以“t”间隔轮询服务器并获取状态。为此,我们需要以“t”间隔调用一个函数,该函数将启动对 HTTPHandler 的 AJAX 调用以获取状态。

$(function() {
  setInterval(update, 't');
});

function updateStatus() {
  $.ajax({ type: "POST",  url: "GetStatusHandler.ashx",
       contentType: "text/html; charset=utf-8",
       dataType: "html",  
       success: function(data) { UpdateStatus - Update some progressbar plugin }
       });
}

3.服务器端状态管理

在您的情况下,可能会出现多个活动发票的情况,因此您需要在每个 AJAX 请求时更新/维护所有这些记录的状态。

另外,我不确定您是否可以通过此技术使用 ASP.NET 服务器端进度条控件,因为您需要在客户端更新它们。

To show actual progress you would need to get the status from the server and update the UI at client side. One way is to use HTTP Handlers and AJAX with jQuery.

1. Initiate InvoiceCreation

$("#btnCreateInvoice").click(function() {             
       $.ajax({ type: "POST",  url: "YourHttpHandler.ashx",
       contentType: "text/html; charset=utf-8",
       dataType: "html",  
       success: function(data) { UpdateStatus-Initialize some progressbar plugin }
       });
    });

2. Polling

What next you need to do is to poll the server at 't' interval and get the status. For that we need to call a function at 't' interval that would initiate an AJAX call to a HTTPHandler to get the status.

$(function() {
  setInterval(update, 't');
});

function updateStatus() {
  $.ajax({ type: "POST",  url: "GetStatusHandler.ashx",
       contentType: "text/html; charset=utf-8",
       dataType: "html",  
       success: function(data) { UpdateStatus - Update some progressbar plugin }
       });
}

3. Server side Status Management

In your case there will be a situation where there can be multiple active invoices, so you would need to update/maintain status of all those records every AJAX request.

Also I am not sure you can use ASP.NET Server side progress bar controls with this technique since you would need to update them at client side.

最美的太阳 2024-08-25 19:40:18

这类似于我不久前看到的一个问题“在.NET中上传大文件

这一切的结果是您应该使用 AJAX 方法来间歇性地更新进度条。为此已经存在一些控件,如该问题的答案中建议使用 JavaScript/Flash 库 SWFUpload

就我个人而言,我会重新发明轮子并编写自己的 AJAX 服务器和客户端请求来更新表单,但这需要一些研究。

This is similar to a question I saw a while ago "Upload large files in .NET"

The upshot of it all was that you should use an AJAX method to update the progress bar intermittently. Some controls already exist for this, as in the answer for that question suggests the JavaScript/Flash library SWFUpload.

Personally, I would re-invent the wheel and write my own AJAX server and client requests to update the form, but that requires some research.

恍梦境° 2024-08-25 19:40:18

我在此处此处。它们看起来都比较容易使用。

困难的部分是弄清楚你目前的处理进展到了什么程度。假设您拥有此信息,您可以简单地将 GridView 包装在 UpdatePanel 中,该 UpdatePanel 在 Timer 控件上触发,每 n 秒回发一次。

I found a couple of nice Progress Bar controls here and here. Both of them seem relatively easy to use.

The hard part is figuring out how far along you currently are in your processing. Assuming that you have this information, you could simply wrap the GridView in an UpdatePanel that triggers on a Timer control which posts back every n seconds.

余厌 2024-08-25 19:40:18

这是一件很难完成的事情。

图片上传之所以有进度条,是因为客户端知道它已经向服务器发送了多少数据。

但在这种情况下,客户端不知道服务器有多远,服务器也很难告诉客户端。

我没有解决方案,但我只想说这并不简单。

This is a hard thing to accomplish.

The reason why the image upload has a progress bar, is because the client know how much data it has send to the server.

But in this case, the client doesn't know how far the server is, and it's hard for the server to tell the client.

I don't have a solution, but I just want to say it's not straight forward.

~没有更多了~
我们使用 Cookies 和其他技术来定制您的体验包括您的登录状态等。通过阅读我们的 隐私政策 了解更多相关信息。 单击 接受 或继续使用网站,即表示您同意使用 Cookies 和您的相关数据。
原文