麻豆小视频在线观看_中文黄色一级片_久久久成人精品_成片免费观看视频大全_午夜精品久久久久久久99热浪潮_成人一区二区三区四区

首頁(yè) > 學(xué)院 > 開(kāi)發(fā)設(shè)計(jì) > 正文

ASPNETPager常用屬性(近來(lái)用到分頁(yè)屬性)

2019-11-17 02:00:20
字體:
來(lái)源:轉(zhuǎn)載
供稿:網(wǎng)友

aspNETPager常用屬性(近來(lái)用到分頁(yè)屬性)

ASPNETPager常用屬性

建議去封裝好,然后調(diào)用這樣比較容易

<webdiyer:aspnetpager id="AspNetPager1" runat="server"

alwaysshow="True"

PageSize="5"

custominfosectionwidth="20%"

custominfotextalign="Right"

firstpagetext="第一頁(yè)"

horizontalalign="Left"

lastpagetext="末一頁(yè)"

navigationbuttontype="Image"

nextpagetext="后一頁(yè)"

pageindexboxtype="TextBox"

pagingbuttonspacing="8px"

showcustominfosection="Right"

showpageindexbox="Always"

textafterpageindexbox="頁(yè)"

UrlPaging="true"

textbeforepageindexbox="跳到第"

width="97%"

onpagechanged="AspNetPager1_PageChanged">

</webdiyer:aspnetpager>

alwaysshow:總是顯示分頁(yè)控件;

PageSize:指定每頁(yè)顯示的記錄數(shù);

custominfosectionwidth:用戶(hù)自定義信息區(qū)的寬度;

custominfotextalign:用戶(hù)自定義信息區(qū)的對(duì)齊方式;

firstpagetext:第一頁(yè)按鈕上顯示的文本;

horizontalalign:內(nèi)容水平對(duì)齊方式;

lastpagetext:最后頁(yè)按鈕上顯示的文本;

navigationbuttontype:第一頁(yè)、下一頁(yè)、最后一頁(yè)按鈕的類(lèi)型;

nextpagetext:下一頁(yè)按鈕上顯示的文本;

pageindexboxtype:指示頁(yè)索引框的顯示類(lèi)型:有TextBOX和dropdownlist兩種;

pagingbuttonspacing:導(dǎo)航頁(yè)按鈕的間距;

prevpagetext:上一頁(yè)按鈕的顯示的文本;

showcustominfosection:顯示當(dāng)前頁(yè)和總頁(yè)信息,默認(rèn)為不顯示,值為L(zhǎng)EFT時(shí)將顯示在頁(yè)索引前,為right時(shí)顯示在頁(yè)索引后;

showpageindexbox:指定頁(yè)索引文本框或下拉框的顯示方式;

textafterpageindexbox:指定頁(yè)索引文本框或下拉框后的文本;

UrlPaging:是夠使用URL傳遞分頁(yè)的方式來(lái)分頁(yè);

textbeforepageindexbox:指定頁(yè)索引文本框或下拉框前面顯示的文本;

width:該控件的寬度;

CustomInfoHTML:指定要顯示在用戶(hù)自定義信息區(qū)的用戶(hù)自定義HTML信息文本

using System;

using System.Configuration;

using System.Data;

using System.Linq;

using System.Web;

using System.Web.Security;

using System.Web.UI;

using System.Web.UI.HtmlControls;

using System.Web.UI.WebControls;

using System.Web.UI.WebControls.WebParts;

using System.xml.Linq;

using System.Data.SqlClient;

public partial class _Default : System.Web.UI.Page

{

protected void Page_Load(object sender, EventArgs e)

{

Bind();

}

private void Bind()

{

int pageindex = 1;

int pagenum = AspNetPager1.PageSize;

if (Request["page"] != null)

{

pageindex =Convert.ToInt32(Request["page"]);

}

DataSet ds = new DataSet();

SqlConnection con = new SqlConnection(ConfigurationManager.ConnectionStrings["constr"].ToString ());

SqlConnection con1 = new SqlConnection(ConfigurationManager.ConnectionStrings["constr"].ToString());

SqlDataAdapter sda = new SqlDataAdapter("select top (@pagenum) * from pagetest where id not in (select top (@pagenum*(@pageindex-1)) id from pagetest)", con);

sda.SelectCommand.Parameters.AddWithValue("pagenum",pagenum);

sda.SelectCommand.Parameters.AddWithValue("pageindex",pageindex);

sda.Fill(ds);

SqlCommand cmd = new SqlCommand("select count(*) from pagetest", con1);

con1.Open();

AspNetPager1.RecordCount =Convert.ToInt32(cmd.ExecuteScalar());

con.Close();

AspNetPager1.CustomInfoHTML = "共" + AspNetPager1.RecordCount + "條記錄" + AspNetPager1.CurrentPageIndex + "/" + AspNetPager1.PageCount;

GridView1.DataSource = ds.Tables[0].DefaultView;

GridView1.DataBind();

}

protected void AspNetPager1_PageChanged(object sender, EventArgs e)

{

Bind();

}

}

深入分析CurrentPageIndex、RecordCount、PageCount、PageSize:

pagecount:

public int PageCount

{

get

{

if (this.RecordCount == 0)

{

return 1;

}

return (int) Math.Ceiling((double) (((double) this.RecordCount) / ((double) this.PageSize)));

}

}

recordcount:

public int RecordCount

{

get

{

if (this.cloneFrom != null)

{

return this.cloneFrom.RecordCount;

}

object obj2 = this.ViewState["Recordcount"];

if (obj2 != null)

{

return (int) obj2;

}

return 0;

}

set

{

this.ViewState["Recordcount"] = value;

}

}

CurrentPageIndex:

public int CurrentPageIndex

{

get

{

if (this.cloneFrom != null)

{

return this.cloneFrom.CurrentPageIndex;

}

object obj2 = this.ViewState["CurrentPageIndex"];

int num = (obj2 == null) ? 1 : ((int) obj2);

if ((num > this.PageCount) && (this.PageCount > 0))

{

return this.PageCount;

}

if (num < 1)

{

return 1;

}

return num;

}

set

{

int pageCount = value;

if (pageCount < 1)

{

pageCount = 1;

}

else if (pageCount > this.PageCount)

{

pageCount = this.PageCount;

}

this.ViewState["CurrentPageIndex"] = pageCount;

}

}

PageSize:

public int PageSize

{

get

{

int num;

if ((!string.IsNullOrEmpty(this.UrlPageSizeName) && !base.DesignMode) && (int.TryParse(this.Page.Request.QueryString[this.UrlPageSizeName], out num) && (num > 0)))

{

return num;

}

if (this.cloneFrom != null)

{

return this.cloneFrom.PageSize;

}

object obj2 = this.ViewState["PageSize"];

if (obj2 != null)

{

return (int) obj2;

}

return 10;

}

set

{

this.ViewState["PageSize"] = value;

}

}

AlwaysShow

獲取或設(shè)置一個(gè)值,該值指定是否總是顯示AspNetPager分頁(yè)按件,即使要分頁(yè)的數(shù)據(jù)只有一頁(yè)。

CurrentPageButtonPosition

當(dāng)前頁(yè)數(shù)字按鈕在所有數(shù)字分頁(yè)按鈕中的位置,可選值為:Beginning(最前)、End(最后)、Center(居中)和Fi

發(fā)表評(píng)論 共有條評(píng)論
用戶(hù)名: 密碼:
驗(yàn)證碼: 匿名發(fā)表
主站蜘蛛池模板: 国产成人免费精品 | 国产91久久久久久 | a黄网站| 久久最新网址 | 亚洲精品在线观看免费 | 一区二区精品视频 | 久久久久久久黄色片 | 欧美重口另类videos人妖 | 国产精品99久久久久久大便 | 欧美一区二区精品夜夜嗨 | 久久华人| v片在线看 | 亚洲成人中文字幕在线 | 麻豆传传媒久久久爱 | 成人免费看视频 | 亚洲一级电影在线观看 | 一级一片免费看 | 国产高潮好爽好大受不了了 | 亚洲va久久久噜噜噜久久男同 | 黄色免费在线视频网站 | 91午夜免费视频 | 日韩精品久久久久久久九岛 | 亚洲精品成人18久久久久 | 欧美性猛交xxx乱大交3蜜桃 | 亚洲午夜天堂吃瓜在线 | 黄色美女免费 | 狠狠干天天操 | 久久9色 | 国产精品视频一区二区三区综合 | 亚洲国产超高清a毛毛片 | 黄色片网站免费 | 亚洲精品一区国产精品丝瓜 | 欧美成人黄色小视频 | 一级毛片电影网 | 成人毛片av在线 | 国产精品一品二区三区四区18 | 久久91亚洲精品久久91综合 | 一级电影在线免费观看 | 毛片网站视频 | 国产妞干网| 免费在线观看毛片视频 |