小男孩‘自慰网亚洲一区二区,亚洲一级在线播放毛片,亚洲中文字幕av每天更新,黄aⅴ永久免费无码,91成人午夜在线精品,色网站免费在线观看,亚洲欧洲wwwww在线观看

分享

AspNetAjaxPager,Asp.Net通用無(wú)刷新Ajax分頁(yè)控件,支持多樣式多數(shù)據(jù)...

 狂人隱士 2012-09-19
最近閑來(lái)沒(méi)事,總結(jié)了一些asp.net分頁(yè)經(jīng)驗(yàn),為使用方便現(xiàn)在寫(xiě)了一個(gè)可以通用的分頁(yè)控件:AspNetAjaxPager:,使用ajax技術(shù)實(shí)現(xiàn)無(wú)刷新分頁(yè),能夠控制所有數(shù)據(jù)綁定控件的分頁(yè),自己覺(jué)得效果還是挺不錯(cuò)的,現(xiàn)在奉獻(xiàn)給大家!
本控件可以對(duì)GridView,Repeater,DataGrid,DataList...幾乎所有的.net數(shù)據(jù)綁定控件進(jìn)行分頁(yè),全部無(wú)刷新,數(shù)據(jù)綁定部分可以使用存儲(chǔ)過(guò)程也可以直接使用sql語(yǔ)句,這對(duì)本控件沒(méi)有任何干擾!本控件具有較好的用戶界面,能夠根據(jù)需要變換各種樣式,配合css控制效果則更好!
1.分頁(yè)樣式效果圖:
分頁(yè)樣式效果圖
2.如何使用:
于bin目錄下添加:AspNetAjaxPager.dll引用
aspx文件內(nèi)容:
復(fù)制代碼 代碼如下:

<%@ 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./TR/xhtml1/DTD/xhtml1-transitional.dtd">
<!--
//======================================================================
// 公司名稱: 野人網(wǎng)絡(luò)工作室(http://www.)
// 機(jī)器名稱: WWW-BBE63F97A80
// 注冊(cè)組織名: Lenovo (Beijing) Limited
// CLR版本: 2.0.50727.1433
// 文件名稱: Default.aspx
// 創(chuàng)建者: 邵龍
// 創(chuàng)建時(shí)間: 2009-4-4 16:29:49
// 程序版本: 1.0版
// 功能描述: AspNetAjaxPager使用Demo
// 修改記錄:
//======================================================================
-->
<html xmlns="http://www./1999/xhtml" >
<head runat="server">
<title>AspNetAjaxPager使用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>
</head>
<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>編號(hào)</td>
<td>姓名</td>
<td>年齡</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="當(dāng)前使用中:" GotoButtonValue="轉(zhuǎn)到"
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="轉(zhuǎn)到" 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="轉(zhuǎn)到" 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="轉(zhuǎn)到"
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="轉(zhuǎn)到" 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="轉(zhuǎn)到" 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="轉(zhuǎn)到" IsGotoSelectVisible="False" IsGotoTextBoxVisible="False"
PagedControlID="Repeater1" RecordCount="1500" CurrentNumberBgColor="Yellow" CurrentPageColor="Lime" LinkNumberWidth="20px" />
<br />
<br />
</div>
</div>
</form>
</body>
</html>
<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>

.cs文件內(nèi)容:
復(fù)制代碼 代碼如下:

//======================================================================
// 公司名稱: 野人網(wǎng)絡(luò)工作室(http://www.)
// 機(jī)器名稱: WWW-BBE63F97A80
// 注冊(cè)組織名: Lenovo (Beijing) Limited
// CLR版本: 2.0.50727.1433
// 文件名稱: Default.aspx.cs
// 創(chuàng)建者: 邵龍
// 創(chuàng)建時(shí)間: 2009-4-4 16:29:49
// 程序版本: 1.0版
// 功能描述: AspNetAjaxPager使用Demo
// 修改記錄:
//======================================================================
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
{
///點(diǎn)擊分頁(yè)導(dǎo)航時(shí)由控件代理對(duì)象觸發(fā)綁定事件重新顯示數(shù)據(jù)
this.Pager1.OnPageIndexChanged = new PageIndexChangedDelegate(BindData);
}
}
/// <summary>
/// 綁定Repeater數(shù)據(jù)
/// </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();
///此部分可以換成存儲(chǔ)過(guò)程分頁(yè),對(duì)控件沒(méi)有任何影響
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();
}
}
}

    本站是提供個(gè)人知識(shí)管理的網(wǎng)絡(luò)存儲(chǔ)空間,所有內(nèi)容均由用戶發(fā)布,不代表本站觀點(diǎn)。請(qǐng)注意甄別內(nèi)容中的聯(lián)系方式、誘導(dǎo)購(gòu)買(mǎi)等信息,謹(jǐn)防詐騙。如發(fā)現(xiàn)有害或侵權(quán)內(nèi)容,請(qǐng)點(diǎn)擊一鍵舉報(bào)。
    轉(zhuǎn)藏 分享 獻(xiàn)花(0

    0條評(píng)論

    發(fā)表

    請(qǐng)遵守用戶 評(píng)論公約

    類似文章 更多