ASP.net series: Two statements to implement repeater common Ajax paging [Xcallback vs JQ in Ajax]

Source: Internet
Author: User
Tags eval implement

This article will explain another framework of Ajax Xcallback through the Repeater Ajax pagination example. Of course, no matter what Ajax frame you're a fan of, this paging is very practical, you can make the application and you like the framework, after all, everyone likes repeater flexible and fast, but did not provide built-in paging, now you just add a statement on the page can achieve Ajax effect of pagination, the article The statement also will be xcallback and JQ in Ajax use to do a comparison, if I do not speak well, welcome JQ fans correct. We first look at the front and back page, as well as online examples, if it is helpful, then look down, the sample source and everything.

Here is the front page need to write the JS code only the following statements, GetPage contains methods for returning data before and from the server [Note: Ajax.reg (' to pass data ', ' server-side method ')], if the background page has only one callable method, the server method name can be omitted, In fact, you can write more than one statement on the top of Ajax.reg (). These statements will occur before the callback, and you can also write multiple statements below the return, which will be executed after the server returns the data, so that the function structure has many advantages, allowing the data state to be consistent before and after the callback. Keep the context consistent, can be better to share variables, JQ in Ajax use is also because of simplicity and popular, I believe that this xcallback code and JQ have a ratio, or even more concise, there is no superfluous things, completely focus your attention on the business, rather than specific technical details.

<%@ Page language= "C #" autoeventwireup= "true" codefile= "Default.aspx.cs" inherits= "_default"%>
<! DOCTYPE HTML PUBLIC "-//W3C//DTD XHTML 1.0 transitional//en" "Http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd ">
<title></title>
<script type= "Text/javascript" >
onload = function () {
GetPage (0);
}
function GetPage (pindex) {
Ajax.reg (Pindex, "");
Return
$ ("page"). InnerHTML = ajax.x;
}
</script>
<style type= "Text/css" >
. a{height:20px; line-height:20px border-bottom:1px solid #d8dfea; clear:both;
. b{float:left; width:30px;}
. c{float:left; width:500px;}
</style>
<link href= "Page.css" rel= "stylesheet" type= "Text/css"/>
<body>
<form id= "Form1" runat= "Server" >
<div id= "Page" >
<asp:repeater id= "Rep" runat= "Server" >
<ItemTemplate>
<div class=a>
<div class=b>
<%# DataBinder.Eval (Container.DataItem, "id")%>
</div>
<div class=c><%# DataBinder.Eval (Container.DataItem, "title")%>
</div>
</div>
</ItemTemplate>
</asp:Repeater>
</div>
</form>
</body>

Related Article

Contact Us

The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion; products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the content of the page makes you feel confusing, please write us an email, we will handle the problem within 5 days after receiving your email.

If you find any instances of plagiarism from the community, please send an email to: info-contact@alibabacloud.com and provide relevant evidence. A staff member will contact you within 5 working days.

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.