最新国产好看的视频,伊人天堂AV在线,国产Aaaaaa视频,蜜臀视频在线观看一区,人妻av色图,密臀久久久精品影片,青青视频免费观看毛片,久草在线观看视,国产三级精品色情在线

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

 更新時間:2009年04月13日 11:32:30   作者:  
最近閑來沒事,總結(jié)了一些asp.net分頁經(jīng)驗,為使用方便現(xiàn)在寫了一個可以通用的分頁控件:AspNetAjaxPager:,使用ajax技術(shù)實現(xiàn)無刷新分頁,能夠控制所有數(shù)據(jù)綁定控件的分頁,自己覺得效果還是挺不錯的,現(xiàn)在奉獻(xiàn)給大家!
本控件可以對GridView,Repeater,DataGrid,DataList...幾乎所有的.net數(shù)據(jù)綁定控件進(jìn)行分頁,全部無刷新,數(shù)據(jù)綁定部分可以使用存儲過程也可以直接使用sql語句,這對本控件沒有任何干擾!本控件具有較好的用戶界面,能夠根據(jù)需要變換各種樣式,配合css控制效果則更好!
1.分頁樣式效果圖:
分頁樣式效果圖
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.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<!--
//======================================================================
// 公司名稱: 野人網(wǎng)絡(luò)工作室(http://www.wildren.com)
// 機器名稱: WWW-BBE63F97A80
// 注冊組織名: Lenovo (Beijing) Limited
// CLR版本: 2.0.50727.1433
// 文件名稱: Default.aspx
// 創(chuàng)建者: 邵龍
// 創(chuàng)建時間: 2009-4-4 16:29:49
// 程序版本: 1.0版
// 功能描述: AspNetAjaxPager使用Demo
// 修改記錄:
//======================================================================
-->
<html xmlns="http://www.w3.org/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>編號</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.wildren.com)
// 機器名稱: WWW-BBE63F97A80
// 注冊組織名: Lenovo (Beijing) Limited
// CLR版本: 2.0.50727.1433
// 文件名稱: Default.aspx.cs
// 創(chuàng)建者: 邵龍
// 創(chuàng)建時間: 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
{
///點擊分頁導(dǎo)航時由控件代理對象觸發(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();
///此部分可以換成存儲過程分頁,對控件沒有任何影響
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();
}
}
}

相關(guān)文章

  • 讀取XML并綁定至RadioButtonList實現(xiàn)思路及演示動畫

    讀取XML并綁定至RadioButtonList實現(xiàn)思路及演示動畫

    讀取XML的文檔,可以使用System.Data.DataSet類別中的ReadXml()方法,在aspx網(wǎng)頁上拉一個RadioButtonList控件,用來顯示XML的數(shù)據(jù),接下來,用DataSet去讀取剛才寫好的獲取XML文件的屬性,即可完成
    2013-01-01
  • ASP.NET網(wǎng)站實時顯示時間的方法

    ASP.NET網(wǎng)站實時顯示時間的方法

    這篇文章主要介紹了ASP.NET網(wǎng)站實時顯示時間的方法,主要通過AJAX控件來實現(xiàn)該功能,是非常具有實用價值的技巧,需要的朋友可以參考下
    2014-11-11
  • WPF使用代碼創(chuàng)建數(shù)據(jù)模板DataTemplate

    WPF使用代碼創(chuàng)建數(shù)據(jù)模板DataTemplate

    本文詳細(xì)講解了WPF使用代碼創(chuàng)建數(shù)據(jù)模板DataTemplate的方法,文中通過示例代碼介紹的非常詳細(xì)。對大家的學(xué)習(xí)或工作具有一定的參考借鑒價值,需要的朋友可以參考下
    2022-02-02
  • ASP.NET程序中常用代碼匯總

    ASP.NET程序中常用代碼匯總

    對于學(xué)習(xí)asp.net的朋友能用的到
    2008-11-11
  • ADO.NET通用數(shù)據(jù)庫訪問類

    ADO.NET通用數(shù)據(jù)庫訪問類

    這篇文章主要為大家介紹了ADO.NET通用數(shù)據(jù)庫訪問類,利用ADO.NET的體系架構(gòu)打造通用的數(shù)據(jù)庫訪問通用類,感興趣的小伙伴們可以參考一下
    2016-03-03
  • ajaxControlToolkit中CascadingDropDown的用法說明

    ajaxControlToolkit中CascadingDropDown的用法說明

    今天頭叫寫一個類似三級聯(lián)動的控件,最好實現(xiàn)無刷新,是石油軟件中的一個數(shù)據(jù),需要表現(xiàn)出類似 X1-22 這樣的格式,上下標(biāo)的數(shù)據(jù)是固定的 想了很多辦法來表現(xiàn)這個數(shù)字,最后決定用3個DropDownList控件
    2008-11-11
  • asp.net5中用戶認(rèn)證與授權(quán)(2)

    asp.net5中用戶認(rèn)證與授權(quán)(2)

    ASP.NET5主要提供了兩種應(yīng)用程序,其一就是ASP.NET5控制臺程序,另外一個是ASP.NET Web 應(yīng)用程序。本文給大家介紹asp.net5中用戶認(rèn)證與授權(quán)(2),需要的童鞋可以參考下
    2015-10-10
  • 利用.net core實現(xiàn)反向代理中間件的方法

    利用.net core實現(xiàn)反向代理中間件的方法

    這篇文章主要給大家介紹了關(guān)于利用.net core實現(xiàn)反向代理中間件的相關(guān)資料,文中通過示例代碼介紹的非常詳細(xì),對大家學(xué)習(xí)或者使用.net core具有一定的參考學(xué)習(xí)價值,需要的朋友們下面來一起學(xué)習(xí)學(xué)習(xí)吧
    2019-09-09
  • aspx實現(xiàn)的 jquery ui 的 flexgrid demo

    aspx實現(xiàn)的 jquery ui 的 flexgrid demo

    這幾天沒事研究著jquery,真是個好東西,慢慢的知道了有jquery ui,一開始就被華麗的界面和簡單的操作給吸引了,尤其是里面的flexgrid,對我而言可以說是非常寶貴的東西
    2009-12-12
  • asp.net 獲取Datalist中Checkbox的值的小結(jié)

    asp.net 獲取Datalist中Checkbox的值的小結(jié)

    最近開發(fā)過程中遇到一個小問題,要獲取checkbox的值,在網(wǎng)上搜索了一下,發(fā)現(xiàn)基本上都是用JS實現(xiàn)的,現(xiàn)在我將自己的做法記錄一下,以便以后繼續(xù)使用。
    2010-04-04

最新評論

青河县| 安徽省| 汕尾市| 吕梁市| 阿鲁科尔沁旗| 左云县| 延津县| 安吉县| 青州市| 美姑县| 潍坊市| 北川| 南宁市| 徐汇区| 漳浦县| 巍山| 琼中| 新田县| 呼和浩特市| 应城市| 福州市| 内江市| 鄂伦春自治旗| 邵武市| 桐梓县| 都兰县| 无极县| 乳源| 泌阳县| 汕尾市| 商南县| 万安县| 桂林市| 大冶市| 兴仁县| 沙雅县| 锦州市| 灵寿县| 福安市| 慈溪市| 晴隆县|