Www.xiaoxiaoshuo.net aspnetajaxpager,aspnet Universal No-refresh Ajax paging control, supports multi-style multi-data binding

Source: Internet
Author: User
Tags lenovo
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.

  • 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.