我正在使用jquery ajax方法从web方法获取数据,并使用DOM呈现数据(类似于Google搜索结果)因为从Web方法返回的数据很大,所以我想对结果进行分页。为此,我需要根据Web方法从数据库检索的记录数创建对应于页面编号的按钮。因此,我在页面上拿了一个div。在web方法中,一旦我找到了从数据库获取的记录数,我想创建按钮并添加到这个div中,并每页显示10条记录。据我所知,从Web方法无法访问放置在asp.net页面上的任何内容。在这种情况下,我如何分页结果?
请帮忙。
我正在使用jquery ajax方法从web方法获取数据,并使用DOM呈现数据(类似于Google搜索结果)因为从Web方法返回的数据很大,所以我想对结果进行分页。为此,我需要根据Web方法从数据库检索的记录数创建对应于页面编号的按钮。因此,我在页面上拿了一个div。在web方法中,一旦我找到了从数据库获取的记录数,我想创建按钮并添加到这个div中,并每页显示10条记录。据我所知,从Web方法无法访问放置在asp.net页面上的任何内容。在这种情况下,我如何分页结果?
请帮忙。
如果您正在使用JQuery ajax,则可以通过执行以下语句在客户端上重新创建UI:
$("<input/>").attr("type", "button").click(function() { .. }).appendTo("parentElementselector");
$.each(webmethodresults, function(i, item) {
//Create UI here using approach illustrated above
});
并针对每一页编程重新创建。
编辑,或者找一个第三方表格控件,你可以在客户端绑定。MS AJAX 4有一些客户端JS组件来实现这个,或者有一些JQuery的组件……但无论如何,如果使用JQuery通过AJAX流式传输,您必须在客户端上创建。
这是处理此情景的另一种建议:
In my webpages I have references to js and images as such: "../../Content/Images/"Filename" In my code if I reference a file as above, it doesnt work so i have to write: "c:/miscfiles/"filename" 1-...
I m the only developer in my company, and am getting along well as an autodidact, but I know I m missing out on the education one gets from working with and having code reviewed by more senior devs. ...
Heres the problem, In Masterpage, the google analytics code were pasted before the end of body tag. In ASPX page, I need to generate a script (google addItem tracker) using codebehind ClientScript ...
I m looking for best practices here. Sorry. I know it s subjective, but there are a lot of smart people here, so there ought to be some "very good" ways of doing this. I have a custom object called ...
I am implementing Transaction using TransactionScope with the help this MSDN article http://msdn.microsoft.com/en-us/library/system.transactions.transactionscope.aspx I just want to confirm that is ...
i have the following base controller... public class BaseController : Controller { protected override void Initialize(System.Web.Routing.RequestContext requestContext) { if (...
For what it is necessary Microsoft.Contracts namespace in asp.net? I mean, in what cases I could write using Microsoft.Contracts;?
I d like to add a simple separator line in an aspx web form. Does anyone know how? It sounds easy enough, but still I can t manage to find how to do it.. 10x!