AJAX异步更新,并向用户持续更新消息 [英] AJAX asynchronous update with continuous update message to the user

查看:100
本文介绍了AJAX异步更新,并向用户持续更新消息的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我最近正在尝试解决此问题.我在asp.net 2.0中尝试使用AdventureWorks(SQL 2005)的[Production].[Product]表进行此操作.
问题如下:

Default.aspx中GridView中的特定行数.第一列是供用户选择任意行的复选框字段.第二和第三列是Product表中的ProductId和Name.

有一个用于触发异步回发的插入"按钮,还有一个可向用户显示消息的标签.用户通过选中行前面的复选框来选择一些行,然后单击插入"按钮.现在,应将所选行插入到另一个具有ID,ProductId和Name字段的表中.

此外,假设用户从GridView中显示的10行中选择6行.在将这些行一个接一个地插入到另一个表中时,消息应显示为用户:对于所选的每一行,插入{6}中的{1}". :doh:

请有人提供解决此问题的方法.

I was recently trying with this problem. I was trying this in asp.net 2.0 and using [Production].[Product] table of AdventureWorks (SQL 2005).

The problem is as follows:

Some particular number of rows in GridView in Default.aspx. The first column is a checkbox field for user to select arbitrary rows. The second and third columns are ProductId and Name from Product table.

There is one Insert button for triggering asynchronous postback and one lable to show message to the user. The user selects some rows by checking the checkboxes in front of rows and clicks Insert button. Now, the selected rows should be inserted in another table with fields Id, ProductId and Name.

Further, suppose, the user selects 6 rows out of 10 displayed inside GridView. While these rows being inserted one by one into another table the message should be displayed to the user as: "Inserting {1} of {6} selected" for each row selected. :doh:

Please someone provide solution to this problem.

推荐答案

如果一次发送所有ID,删除行并返回任何错误的响应,则将获得更好的性能. .
最耗时的是客户端与Web服务器以及Web服务器与数据库之间的连接和数据传输.
通过全部发送,可以将其从6个Web服务器和数据库调用减少到一个.
You will get better performance if you send all the IDs at once, deleting the rows, and returning a response with any errors.
What takes the most time is the connection and data transmission between the client and the web server and the web server and the database.
By sending all, you reduce it from 6 web server and database calls to one.


这篇关于AJAX异步更新,并向用户持续更新消息的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆