分頁復合件

2021-07-04 05:58:51 字數 3544 閱讀 3746

using system;

using system.collections.generic;

using system.componentmodel;

using system.text;

using system.web;

using system.web.ui;

using system.web.ui.webcontrols;

using system.data;

using system.data.sqlclient;

using system.configuration;

using system.xml;

namespace mypager

:pager runat=server>")]

public class pager : control, inamingcontainer

get }[

bindable(true),

category("hgproperty"),

defaultvalue(""),

description("讀取表名")

]public string tablename

get }[

bindable(true),

category("hgproperty"),

defaultvalue(""),

description("條件語句,不需要where")

]public string wherestr

get }[

bindable(true),

category("hgproperty"),

defaultvalue(""),

description("排序語句,不需要order by ")

]public string orderby

get }[

bindable(true),

category("hgproperty"),

defaultvalue(""),

description("顯示資料控制項名稱")

]public string controlname

get }[

bindable(true),

category("hgproperty"),

defaultvalue(""),

description("顯示資料控制項型別")

]public controltype viewcontroltype

get }[

bindable(true),

category("hgproperty"),

defaultvalue(""),

description("每頁記錄數")

]public int pagesize

get

}public enum controltype

[bindable(true),

category("hgproperty"),

defaultvalue(""),

description("分頁控制項外div樣式")

]public string pagerstyle

get }[

bindable(true),

category("hgproperty"),

defaultvalue(""),

description("linkbtn鏈結樣式")

]public string linkstyle

get }[

bindable(true),

category("hgproperty"),

defaultvalue(""),

description("焦點文字樣式(頁數,記錄數,當前頁)")

]public string focusstyle

get

}protected override void oninit(eventargs e)

// base.createchildcontrols();

}protected override void createchildcontrols()

void drp_selectedindexchanged(object sender, eventargs e)

#region linkbutton的click事件

void index_click(object sender, eventargs e)

void pre_click(object sender, eventargs e)

#endregion

#region 設計時支援

///

/// 設計時支援

///

///

}#endregion

//public override void databind()

sqlcommand cmd2 = new sqlcommand("select count(id) from " + _tablename + sql2, con);

i = convert.toint32(cmd2.executescalar());

con.close();

con.dispose();

_rowcount = i;

if ((_rowcount % _pagesize) == 0)

else

_pageindex = intpageindex;

linkbutton lindex=(linkbutton)this.findcontrol("index");

linkbutton lpre=(linkbutton)this.findcontrol("pre");

linkbutton lnext=(linkbutton)this.findcontrol("next");

linkbutton lend=(linkbutton)this.findcontrol("end");

lindex.visible = true;

lindex.enabled = true;

lpre.visible = true;

lnext.visible = true;

lend.visible = true;

lend.enabled = true;

if (intpageindex == 1)

if (intpageindex == _pagecount)

((literal)this.findcontrol("pagecount")).text=_pagecount.tostring();

((literal)this.findcontrol("rowcount")).text = _rowcount.tostring();

((literal)this.findcontrol("pindex")).text = _pageindex.tostring();

//繫結dropdownlist

if (!page.ispostback)

}return sb.tostring();}}

}

Yii 分頁鏈結定製 復合條件分頁 整理學習

要實現這樣的乙個列表分頁的功能 如下 分頁需要在controller裡面例項化cpagination物件,這個物件有乙個public屬性 route,這個屬性預設是為空的,也就是分頁的鏈結是以當前請求的url為準的。我們可以給他賦值,yii就會以我們想要的位址去寫分頁鏈結的位址了。controlle...

分頁和中介軟體

一 分頁 批量匯入資料 booklist for i in range 100 book.objects.bulk create booklist 分頁器的使用 book list book.objects.all paginator paginator book list,10 print cou...

python復合型別 python復合型別

鏈結 list python的列表的特點 可以隨時新增和刪除元素 可以做的操作有 切片,新增,刪除,查詢,修改,排序 列表元素可以是不同型別,在型別不同的情況下就無法排序 列表是有序的 定義小馬列表 li twilight pinkiepie rainbow dash 插入 insert self ...