This control can be used on gridview,repeater,datagrid,datalist ... Almost all. NET data-bound controls are paged, none refreshed, and the data-bound section can use stored procedures or use SQL statements directly, without any interference with the control! This control has a good user interface, can transform various styles according to need, with CSS control effect is better!
1. Pagination Style:
2. How to use:
Add: AspNetAjaxPager.dll reference in Bin directory
aspx file contents:
Copy the Code code as follows:
<%@ page language= "C #" autoeventwireup= "true" codefile= "Default.aspx.cs" inherits= "Demo._default"%>
<%@ Register namespace= "Aspnetajaxpager" tagprefix= "Ajax" assembly= "Aspnetajaxpager"%>
Aspnetajaxpager using Demo
. cs file Contents:
Copy the 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: Shao
Creation time: 2009-4-4 16:29:49
Program Version: 1.0 version
Function Description: Aspnetajaxpager using 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 proxy object triggers a binding event to re-display the data when you click the pager
This. pager1.onpageindexchanged = new Pageindexchangeddelegate (binddata);
}
}
///
Binding repeater data
///
///
///
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 replaced with stored procedure paging, which 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 ();
}
}
}
The above describes the Www.xiaoxiaoshuo.net aspnetajaxpager,aspnet Universal no-refresh Ajax paging control, support multi-style multi-data binding, Includes the content of www.xiaoxiaoshuo.net, hope to be interested in PHP tutorial friends helpful.