Home  >  Article  >  Backend Development  >  AspNetAjaxPager, Asp.Net universal non-refresh Ajax paging control, supports multi-style and multi-data binding_PHP tutorial

AspNetAjaxPager, Asp.Net universal non-refresh Ajax paging control, supports multi-style and multi-data binding_PHP tutorial

WBOY
WBOYOriginal
2016-07-21 15:47:11723browse

This control can paginate GridView, Repeater, DataGrid, DataList... almost all .net data binding controls, all without refreshing. The data binding part can use stored procedures or directly use sql statements, which has no impact on this control. interference! This control has a good user interface and can change various styles according to needs. The effect is even better when combined with css control!
1. Pagination style rendering:
分页样式效果图
2. How to use:
Add in the bin directory: AspNetAjaxPager.dll references the content of the
aspx file:

Copy code The code is as follows:

<%@ Page Language="C#" AutoEventWireup="true" CodeFile="Default.aspx.cs" Inherits="Demo._Default" %>
<%@ Register Namespace="AspNetAjaxPager" TagPrefix="ajax" Assembly="AspNetAjaxPager"%>




AspNetAjaxPager使用Demo

























编号 姓名 年龄

<%# Eval("id")%>

<%# Eval("name") %>

<%# Eval("age")%>





BackColor="Transparent" BorderColor="Red" BorderWidth="0px" DescriptionText="当前使用中:" GotoButtonValue="转到"
CssClass="navi" IsGotoSelectVisible="False" IsGotoTextBoxVisible="False" LeftPageSize="0" RightPageSize="0" CurrentNumberBgColor="White" />





BackColor="Transparent" BorderColor="Red" BorderWidth="0px" DescriptionText="" GotoButtonValue="转到" CssClass="navi"
RecordCount="1500" IsGotoSelectVisible="False" IsGotoTextBoxVisible="False"/>




BackColor="Transparent" BorderColor="Red" BorderWidth="0px" DescriptionText="" GotoButtonValue="转到" CssClass="navi"
RecordCount="1500" IsGotoSelectVisible="False"/>




BackColor="Transparent" BorderColor="Red" BorderWidth="0px" CssClass="navi" DescriptionText=""
GotoButtonValue="转到"
PagedControlID="Repeater1" RecordCount="1500" />




BackColor="DarkGray" BorderColor="Red" BorderWidth="1px" CssClass="navi" DescriptionText=""
GotoButtonValue="转到" IsGotoSelectVisible="False"
PagedControlID="Repeater1" RecordCount="1500" CellSpacing="1px" />






BackColor="Transparent" BorderColor="Red" BorderWidth="0px" CssClass="navi" DescriptionText=""
GotoButtonValue="转到" IsGotoTextBoxVisible="False"
PagedControlID="Repeater1" RecordCount="1500" LinkIsText="False" NextLink="img/next.gif" FirstLink="img/first.gif" LastLink="img/last.gif" PreviousLink="img/previous.gif" />




BackColor="Transparent" BorderColor="Red" BorderWidth="0px" CssClass="navi" DescriptionText=""
GotoButtonValue="转到" IsGotoSelectVisible="False" IsGotoTextBoxVisible="False"
PagedControlID="Repeater1" RecordCount="1500" CurrentNumberBgColor="Yellow" CurrentPageColor="Lime" LinkNumberWidth="20px" />











.cs文件内容:
复制代码 代码如下:

//============================================ ============================
// Company name: Wildren 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
// Creator: Shao Long
// Creation time: 2009-4-4 16:29:49
// Program version: Version 1.0
// Function description: AspNetAjaxPager uses Demo
//Modification 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
{
///Click During paging navigation, the binding event is triggered by the control proxy object to redisplay the data
this.Pager1.OnPageIndexChanged = new PageIndexChangedDelegate(BindData);
}
}
///
/// Bind 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" ; 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();
}
}
}




http://www.bkjia.com/PHPjc/320009.html

www.bkjia.com

http: //www.bkjia.com/PHPjc/320009.htmlTechArticleThis control can be used for GridView, Repeater, DataGrid, DataList...almost all .net data binding controls. Paging, all without refreshing, the data binding part can use stored procedures or directly...
Statement:
The content of this article is voluntarily contributed by netizens, and the copyright belongs to the original author. This site does not assume corresponding legal responsibility. If you find any content suspected of plagiarism or infringement, please contact admin@php.cn