Aspnetajaxpager,asp.net Universal No Refresh Ajax paging control, support multi-style multi-data binding _php techniques

Source: Internet
Author: User
Tags lenovo
This control can be used for gridview,repeater,datagrid,datalist ... Almost all of the. NET data-bound controls are paginated, all without refreshes, and the data-binding section can use stored procedures or use SQL statements directly, which has no interference with this control! This control has a good user interface, can be changed according to the needs of various styles, with CSS control effect is better!
1. Pagination Style Effect chart:

2. How to use:
Add in Bin directory: AspNetAjaxPager.dll reference
aspx file contents:
Copy Code code as follows:

<%@ Page language= "C #" autoeventwireup= "true" codefile= "Default.aspx.cs" inherits= "Demo._default"%>
<%@ Register namespace= "Aspnetajaxpager" tagprefix= "Ajax" assembly= "Aspnetajaxpager"%>
<! DOCTYPE HTML PUBLIC "-//W3C//DTD XHTML 1.0 transitional//en" "Http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd ">
<!--
//======================================================================
Company Name: Savage Network Studio (http://www.wildren.com)
Machine Name: WWW-BBE63F97A80
Registered Organization Name: Lenovo (Beijing) Limited
CLR version: 2.0.50727.1433
File name: Default.aspx
Created by: Shaolong
Date Created: 2009-4-4 16:29:49
Program Version: 1.0 edition
Function Description: Aspnetajaxpager use Demo
To modify a record:
//======================================================================
-->
<title>aspnetajaxpager Use demo</title>
<link href= "Css/style.css" type= "Text/css" rel= "stylesheet"/>
<script src= "Js/jquery-1.3.2.min.js" type= "Text/javascript" ></script>
<body>
<form id= "Form1" runat= "Server" >
<div>
<div id= "Pannel" >
<div class= "Pagingwrapper" >
<asp:repeater id= "Repeater1" runat= "Server" >
<HeaderTemplate>
<table border= "0" cellpadding= "0" cellspacing= "0" class= "stripe" >
<tr>
<td> number </td>
<td> name </td>
<td> Age </td>
</tr>
</HeaderTemplate>
<ItemTemplate>
<tr>
<td>
<%# Eval ("id")%>
</td>
<td>
<%# Eval ("name")%>
</td>
<td>
<%# Eval ("Age")%>
</td>
</tr>
</ItemTemplate>
<FooterTemplate>
</table>
</FooterTemplate>
</asp:Repeater>
</div>
<div>
<ajax:ajaxpager id= "Pager1" runat= "Server" ajaxcontainerid= "Pannel" pagedcontrolid= "Repeater1" align= "left"
backcolor= "Transparent" bordercolor= "Red" borderwidth= "0px" descriptiontext= "currently in use:" Gotobuttonvalue= "Go"
Cssclass= "Navi" isgotoselectvisible= "false" isgototextboxvisible= "false" leftpagesize= "0" rightpagesize= "0" currentnumberbgcolor= "White"/>
<br/>
<br/>
</div>
<ajax:ajaxpager id= "AjaxPager1" runat= "Server" ajaxcontainerid= "Pannel" pagedcontrolid= "Repeater1" align= "left"
backcolor= "Transparent" bordercolor= "Red" borderwidth= "0px" descriptiontext= "" gotobuttonvalue= "to" CssClass= "Navi"
recordcount= "1500" isgotoselectvisible= "false" isgototextboxvisible= "false"/>
<br/>
<br/>
<ajax:ajaxpager id= "AjaxPager2" runat= "Server" ajaxcontainerid= "Pannel" pagedcontrolid= "Repeater1" align= "left"
backcolor= "Transparent" bordercolor= "Red" borderwidth= "0px" descriptiontext= "" gotobuttonvalue= "to" CssClass= "Navi"
recordcount= "1500" isgotoselectvisible= "False"/>
<br/>
<br/>
<ajax:ajaxpager id= "AjaxPager3" runat= "Server" ajaxcontainerid= "Pannel" align= "left"
backcolor= "Transparent" bordercolor= "Red" borderwidth= "0px" cssclass= "Navi" "descriptiontext=" "
Gotobuttonvalue= "Go"
Pagedcontrolid= "Repeater1" recordcount= "1500"/>
<br/>
<br/>
<ajax:ajaxpager id= "AjaxPager4" runat= "Server" ajaxcontainerid= "Pannel" align= "left"
Backcolor= "Darkgray" bordercolor= "Red" borderwidth= "1px" cssclass= "Navi" "descriptiontext=" "
Gotobuttonvalue= "Go to" isgotoselectvisible= "False"
Pagedcontrolid= "Repeater1" recordcount= "1500" cellspacing= "1px"/>
<br/>
<br/>
<br/>
<ajax:ajaxpager id= "AjaxPager5" runat= "Server" ajaxcontainerid= "Pannel" align= "left"
backcolor= "Transparent" bordercolor= "Red" borderwidth= "0px" cssclass= "Navi" "descriptiontext=" "
Gotobuttonvalue= "Go to" isgototextboxvisible= "False"
Pagedcontrolid= "Repeater1" recordcount= "1500" linkistext= "False" nextlink= "Img/next.gif" firstlink= "Img/first.gif" lastlink= "Img/last.gif" previouslink= "Img/previous.gif"/>
<br/>
<br/>
<ajax:ajaxpager id= "AJAXPAGER6" runat= "Server" ajaxcontainerid= "Pannel" align= "left"
backcolor= "Transparent" bordercolor= "Red" borderwidth= "0px" cssclass= "Navi" "descriptiontext=" "
Gotobuttonvalue= "Go to" isgotoselectvisible= "false" isgototextboxvisible= "false"
Pagedcontrolid= "Repeater1" recordcount= "1500" currentnumberbgcolor= "Yellow" currentpagecolor= "Lime" Linknumberwidth= "20px"/>
<br/>
<br/>
</div>
</div>
</form>
</body>
<script type= "Text/javascript" >
$ (document). Ready (function () {
$ (". Stripe tr"). MouseOver (function () {
$ (this). addclass (' over ');}). Mouseout (function () {
$ (this). Removeclass ("Over");})
$ (". Stripe Tr:even"). AddClass ("alt");
});
</script>

The contents of the. cs file:
Copy Code code as follows:

//======================================================================
Company Name: Savage Network Studio (http://www.wildren.com)
Machine Name: WWW-BBE63F97A80
Registered Organization Name: Lenovo (Beijing) Limited
CLR version: 2.0.50727.1433
File name: Default.aspx.cs
Created by: Shaolong
Date Created: 2009-4-4 16:29:49
Program Version: 1.0 edition
Function Description: Aspnetajaxpager use Demo
To modify a record:
//======================================================================
Using System;
Using System.Data;
Using System.Configuration;
Using System.Web;
Using System.Web.Security;
Using System.Web.UI;
Using System.Web.UI.WebControls;
Using System.Web.UI.WebControls.WebParts;
Using System.Web.UI.HtmlControls;
Using System.Data.OleDb;
Using Aspnetajaxpager.delegate;
Namespace Demo
{
public partial class _default:system.web.ui.page
{
Private OleDbConnection Conn;
Private OleDbCommand cmd;
protected void Page_Load (object sender, EventArgs e)
{
if (! Page.IsPostBack)
{
This. Binddata (this. Pager1.currentpageindex, this. Pager1.pagesize);
}
Else
{
The control agent object triggers the binding event to display the data again when clicking the pager
This. pager1.onpageindexchanged = new Pageindexchangeddelegate (binddata);
}
}
<summary>
Binding repeater data
</summary>
<param name= "PageIndex" ></param>
<param name= "PageSize" ></param>
public void Binddata (int PageIndex, int PageSize)
{
int intstartindex = (PageIndex-1) * PageSize + 1;
int intendindex = PageIndex * PageSize;
conn = new OleDbConnection ();
Conn. ConnectionString = @ "Provider=Microsoft.Jet.OLEDB.4.0;Data source=" + Server.MapPath ("~/app_data/db.mdb");
CMD = conn. CreateCommand ();
Conn. Open ();
This section can be changed to a stored procedure paging and has no effect on the control
Cmd.commandtext = "SELECT count (*) from students";
int totalcount = (int) cmd. ExecuteScalar ();
Cmd.commandtext = string. Format ("SELECT * from students where ID >= {0} and ID <= {1}", Intstartindex, Intendindex);
DataSet ds = new DataSet ();
OleDbDataAdapter da = new OleDbDataAdapter (CMD.COMMANDTEXT, conn);
Da. Fill (DS);
This. Pager1.recordcount = TotalCount;
This. Repeater1.datasource = ds;
This. Repeater1.databind ();
}
}
}
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.