可乐加冰

欢迎来到可乐加冰>>   | 首页 资源中心 | 開發 | 小說連載 | 體育世界 | 人生感悟 | 英語學習 | 計算機軟硬件 | oracle erp學習與交流 | 娛樂 | ITPUB论坛

十天学会asp.net之第九天

发表人:521102yz | 发表时间: 2006年七月06日, 15:48

习目的:学会用DATAGRID分页显示

虽然说DATAGRID的分页显示效率不怎么高,但是不管怎么说,它是最方便的分页显示,对于做一个留言簿还是相当简单实用的。对于启用分页功能还有一个重要要求,只能在DATADRID控件的数据源实现了ICOLLECTION接口的情况下才能启用分页功能,而DATAREADER没有这个接口,所以必须使用DATATABLE来代替。
< script runat="server" language="c#">
void Page_Load()
{
string strConnection="Provider=Microsoft.Jet.OleDb.4.0;Data Source=";
strConnection+=Server.MapPath("guestbook.mdb");
OleDbConnection objConnection=new OleDbConnection(strConnection);
OleDbDataAdapter objDataAdapter=new OleDbDataAdapter("select * from guestbook",objConnection);
DataSet objDataSet=new DataSet();
objDataAdapter.Fill(objDataSet);
dgrdMain.DataSource=objDataSet;
dgrdMain.DataBind();
}
void dgrdMain_PageIndexChanged(Object sender, DataGridPageChangedEventArgs e)
{
dgrdMain.CurrentPageIndex = e.NewPageIndex;
DataBind();
}
< /script>
< html>
< body>
< asp:DataGrid
id="dgrdMain"
cellpadding="1"
showheader="true"
borderwidth="0"
allowpaging="true" 启用分页功能
pagesize="3" 每一页显示三条记录
onpageindexchanged="dgrdMain_pageindexchanged " 调用第×页的函数为dgrdMain_PageIndexChanged()
runat="server"
/>
< /body>
< /html>

--------------------------------------------------------------------------------

<script runat="server" language="vb">
subPage_Load
dim objConnection as OleDbConnection
dim objDataAdapter as OleDbDataAdapter
dim objDataSet as DataSet
objConnection=new OleDbConnection("Provider=Microsoft.Jet.OleDb.4.0;Data Source="+Server.MapPath("guestbook.mdb"))
objDataAdapter=new OleDbDataAdapter("select * from guestbook",objConnection)
objDataSet=new DataSet
objDataAdapter.Fill(objDataSet)
dgrdMain.DataSource=objDataSet
dgrdMain.DataBind()
end sub
sub dgrdMain_PageIndexChanged(sender as object,e as datagridpagechangedeventargs)
dgrdMain.CurrentPageIndex = e.NewPageIndex
DataBind
end sub
< /script>
< html>
< body>
< asp:DataGrid
id="dgrdMain"
cellpadding="1"
showheader="true"
borderwidth="0"
allowpaging="true" 启用分页功能
pagesize="3" 每一页显示三条记录
onpageindexchanged="dgrdMain_pageindexchanged " 调用第×页的函数为dgrdMain_PageIndexChanged()
runat="server"
/>
< /body>
< /html>

这样就是最简单的分页,我们可以用参数pagestyle-mode="nextprev/numericpages"来设定是显示上一页、下一页方式还是直接选择页面的数字方式来实现页面跳转。如果是前者我们可以用pagestyle-nextpagetext来设定包含下一页链接的文本,用pagestyle-prevpagetext来设定包含上一页链接的文本;如果是后者我们可以用PagerStyle-PageButtonCount来设定在使用省略号之前显示的页面编号数量(默认是10)

今天就说到这里,明天说一下SESSION和COOKIE


skhjndwic tmgiyvw [回复]

kpgntqrmb xwljusnh dybe mgisv wvla dwhzgxovt tyqogwb

iswpur hxtcslum | 13/02/2007, 13:39

zkflsov acngt [回复]

bixjgv uxirbo farch dwntyei opmtnrx hozxkt ijgxukh http://www.gpwoe.jiguo.com

vcyz nfrqtyvx | 13/02/2007, 13:39

bszoc apio [回复]

phzguora xakto fnevudyr shkipz axlizhe tvwkbj squvtrdf admwyh vtwefbpd

vcxemfuh eyijrg | 13/02/2007, 13:40

http://chrysler.ds4a.com/ [回复]

buy car http://chrysler.ds4a.com

bmw@gmail.com | 15/02/2007, 23:00

回复 [回复]

hfqed蚂蚁工作室提供专业的网络信息发送,并每次把发送完毕的所有网址列表交给您查验,不对同一网址重复发送,发送资源数据库天天更新,效果比一般其它网络或传统宣传方式更好.QQ:17886808,电话:13983472901,网址:www.mayiqf.cn或mayiqf.cn

hsewvoj | 17/05/2007, 17:18

Prosto osen prosto holodno prosto listopad [回复]

Da delo dazhe ne v goda. Lyyti Keysha.

Lyyti Keysha | 25/05/2007, 06:05

回复 [回复]

kfjvpsqy蚂蚁工作室提供专业的网络信息发送,并每次把发送完毕的所有网址列表交给您查验,不对同一网址重复发送,发送资源数据库天天更新,效果比一般其它网络或传统宣传方式更好.QQ:17886808,电话:13983472901,网址:www.mayiqf.cn或mayiqf.cn

hsexelf | 20/07/2007, 02:17

order viagra [回复]

*2GNHC3 1000 viagra online [url=3000]viagra pharmacy[/url] viagra pharmacy buy cheap viagra buy cheap viagra

order viagra | 24/07/2007, 18:09

viagra now [回复]

*J1QJ60 cheap online viagra cheap online viagra herbal viagra herbal viagra viagra for women viagra for women

viagra now | 24/07/2007, 18:10

discount viagra [回复]

*CG01AN buy viagra now buy viagra now cheap viagra cheap viagra order viagra order viagra

discount viagra | 24/07/2007, 18:11

viagra buy [回复]

*KUOH6H cheap viagra cheap viagra order viagra order viagra purchase viagra purchase viagra

viagra buy | 24/07/2007, 18:11

yhril cxnbrv [回复]

tuqrif dqxuig slnhi hxedmon cruam zrdvxum klpfsjgmn

mforh gxjy | 28/07/2007, 07:07

yhril cxnbrv [回复]

tuqrif dqxuig slnhi hxedmon cruam zrdvxum klpfsjgmn

mforh gxjy | 28/07/2007, 07:10

jqfn inqwe [回复]

yvzjtfk sdqgwvtoy ileydmr orxdf mxlew zqbdc azvohf http://www.mbyd.ibgzr.com

lwayt tzaih | 28/07/2007, 07:10

sufpcrnax zfgi [回复]

ersoxcwag jnfta ivdwxlsb pdeywxitl sdxamtpeu qdluyxrvc afdszcqt tcupg wktqhipb

lkhnsbwyr noywcma | 28/07/2007, 07:12

casodex [回复]

*SXSKVA order casodex order casodex

casodex | 29/08/2007, 06:19

casodex [回复]

*17SEZS order bicalutamide order bicalutamide

casodex | 30/08/2007, 15:03

bicalutamide online [回复]

*RQEYNW order bicalutamide order bicalutamide

bicalutamide online | 02/09/2007, 07:50

bicalutamide [回复]

*MBAHCB here here

bicalutamide | 03/09/2007, 09:23

here [回复]

*GEKHWC buy bicalutamide buy bicalutamide

here | 03/09/2007, 09:23

casodex [回复]

*BLN1H7 cheap bicalutamide cheap bicalutamide

casodex | 03/09/2007, 09:23

casodex online [回复]

*30YWGC buy casodex online buy casodex online

casodex online | 03/09/2007, 09:23

casodex [回复]

*S6DM2G bicalutamide bicalutamide

casodex | 03/09/2007, 09:23

casodex online [回复]

*4L4O38 buy casodex buy casodex

casodex online | 03/09/2007, 09:23

buy casodex online [回复]

*NBS7TR here here

buy casodex online | 04/09/2007, 22:59

casodex no prescription [回复]

*R6Y3T2 buy bicalutamide buy bicalutamide

casodex no prescription | 05/09/2007, 10:39

buy casodex online [回复]

-WSGQ1B buy casodex buy casodex

buy casodex online | 06/09/2007, 20:47

casodex delivery [回复]

-KQ54JF order casodex order casodex

casodex delivery | 17/09/2007, 09:27

online pharmacy [回复]

Value Pharmaceuticals is an online pharmacy that provides cheap prescription drugs online with convenient ordering and confidential delivery to your door.

online pharmacy | 18/09/2007, 22:30

Order your prescription drugs online [回复]

Order your prescription drugs online with no prescription.

Order your prescription drugs online | 18/09/2007, 23:22

Online Pharmacy [回复]

Everything in the known universe about Order Generic Levitra Online. Online Pharmacy - Buy Cheap Levitra.

Online Pharmacy | 19/09/2007, 00:53

No prescription needed [回复]

Online Pharmacy with great discounts. No prescription needed. Buy online safe and secure.

No prescription needed | 19/09/2007, 01:32

discount International pharmacy [回复]

Discount , generic name from our discount International pharmacy. Save Up to 70% On Generic - Buy and over 1100 other prescription drugs online.

discount International pharmacy | 19/09/2007, 02:10

cheap online pharmacy [回复]

We work hard to bring your the cheap online pharmacy you desire. Whether you are looking to for cheap online pharmacy prescription or other low priced.

cheap online pharmacy | 19/09/2007, 03:00

online pharmacy [回复]

Value Pharmaceuticals is an online pharmacy that provides cheap prescription drugs online with convenient ordering and confidential delivery to your door.

online pharmacy | 19/09/2007, 03:42

Order your prescription drugs online [回复]

Order your prescription drugs online with no prescription.

Order your prescription drugs online | 19/09/2007, 04:23

Discount prescription drugs [回复]

Discount prescription drugs for international customers.

Discount prescription drugs | 19/09/2007, 04:59

Discount prescription drugs [回复]

Discount prescription drugs for international customers.

Discount prescription drugs | 19/09/2007, 04:59

Online Pharmacy [回复]

Everything in the known universe about Order Generic Levitra Online. Online Pharmacy - Buy Cheap Levitra.

Online Pharmacy | 19/09/2007, 05:38

Online Pharmacy [回复]

Everything in the known universe about Order Generic Levitra Online. Online Pharmacy - Buy Cheap Levitra.

Online Pharmacy | 19/09/2007, 05:39

discount International pharmacy [回复]

Discount , generic name from our discount International pharmacy. Save Up to 70% On Generic - Buy and over 1100 other prescription drugs online.

discount International pharmacy | 19/09/2007, 06:57

discount International pharmacy [回复]

Discount , generic name from our discount International pharmacy. Save Up to 70% On Generic - Buy and over 1100 other prescription drugs online.

discount International pharmacy | 19/09/2007, 06:57

cheap online pharmacy [回复]

We work hard to bring your the cheap online pharmacy you desire. Whether you are looking to for cheap online pharmacy prescription or other low priced.

cheap online pharmacy | 19/09/2007, 07:39

online pharmacy [回复]

Value Pharmaceuticals is an online pharmacy that provides cheap prescription drugs online with convenient ordering and confidential delivery to your door.

online pharmacy | 19/09/2007, 08:20

online pharmacy [回复]

Value Pharmaceuticals is an online pharmacy that provides cheap prescription drugs online with convenient ordering and confidential delivery to your door.

online pharmacy | 19/09/2007, 08:21

Order your prescription drugs online [回复]

Order your prescription drugs online with no prescription.

Order your prescription drugs online | 19/09/2007, 09:06

Order your prescription drugs online [回复]

Order your prescription drugs online with no prescription.

Order your prescription drugs online | 19/09/2007, 09:07

Discount prescription drugs [回复]

Discount prescription drugs for international customers.

Discount prescription drugs | 19/09/2007, 09:49

Discount prescription drugs [回复]

Discount prescription drugs for international customers.

Discount prescription drugs | 19/09/2007, 09:49

Online Pharmacy [回复]

Everything in the known universe about Order Generic Levitra Online. Online Pharmacy - Buy Cheap Levitra.

Online Pharmacy | 19/09/2007, 10:38

No prescription needed [回复]

Online Pharmacy with great discounts. No prescription needed. Buy online safe and secure.

No prescription needed | 19/09/2007, 11:18

discount International pharmacy [回复]

Discount , generic name from our discount International pharmacy. Save Up to 70% On Generic - Buy and over 1100 other prescription drugs online.

discount International pharmacy | 19/09/2007, 12:12

discount International pharmacy [回复]

Discount , generic name from our discount International pharmacy. Save Up to 70% On Generic - Buy and over 1100 other prescription drugs online.

discount International pharmacy | 19/09/2007, 12:13

cheap online pharmacy [回复]

We work hard to bring your the cheap online pharmacy you desire. Whether you are looking to for cheap online pharmacy prescription or other low priced.

cheap online pharmacy | 19/09/2007, 12:55

Order your prescription drugs online [回复]

Order your prescription drugs online with no prescription.

Order your prescription drugs online | 19/09/2007, 14:16

Discount prescription drugs [回复]

Discount prescription drugs for international customers.

Discount prescription drugs | 19/09/2007, 15:03

Discount prescription drugs [回复]

Discount prescription drugs for international customers.

Discount prescription drugs | 19/09/2007, 15:03

No prescription needed [回复]

Online Pharmacy with great discounts. No prescription needed. Buy online safe and secure.

No prescription needed | 19/09/2007, 16:54

pharmacy technician [回复]

mail order pharmacy

pharmacy technician | 20/09/2007, 00:51

pharmacy technician [回复]

mail order pharmacy

pharmacy technician | 20/09/2007, 00:52

pharmacy technician [回复]

walmart pharmacy

pharmacy technician | 20/09/2007, 17:12

pharmacy technician [回复]

walmart pharmacy

pharmacy technician | 20/09/2007, 17:12

mail order pharmacy [回复]

international pharmacy

mail order pharmacy | 20/09/2007, 17:52

mail order pharmacy [回复]

international pharmacy

mail order pharmacy | 20/09/2007, 17:52

discount pharmacy [回复]

pharmacy technician

discount pharmacy | 20/09/2007, 19:39

discount pharmacy [回复]

pharmacy technician

discount pharmacy | 20/09/2007, 19:40

mexican pharmacy [回复]

walgreens pharmacy

mexican pharmacy | 20/09/2007, 20:27

mexican pharmacy [回复]

walgreens pharmacy

mexican pharmacy | 20/09/2007, 20:27

casodex [回复]

-L9S4ZR bicalutamide bicalutamide

casodex | 23/09/2007, 05:55

bicalutamide delivery [回复]

-25WB6X casodex casodex

bicalutamide delivery | 24/09/2007, 01:25

buy casodex online [回复]

-3JZNVW buy casodex online buy casodex online

buy casodex online | 24/09/2007, 20:03

mail order pharmacy [回复]

canadian pharmacy

mail order pharmacy | 24/09/2007, 22:09

international pharmacy [回复]

cvs pharmacy

international pharmacy | 24/09/2007, 22:50

canadian pharmacy [回复]

canadian pharmacy

canadian pharmacy | 24/09/2007, 23:56

online pharmacy [回复]

mexican pharmacy

online pharmacy | 25/09/2007, 00:41

online pharmacy [回复]

mail order pharmacy

online pharmacy | 25/09/2007, 01:32

mail order pharmacy [回复]

mexican pharmacy

mail order pharmacy | 25/09/2007, 03:59

mail order pharmacy [回复]

mexican pharmacy

mail order pharmacy | 25/09/2007, 03:59

international pharmacy [回复]

pharmacy online

international pharmacy | 25/09/2007, 04:48

mail order pharmacy [回复]

walgreens pharmacy

mail order pharmacy | 25/09/2007, 06:06

mail order pharmacy [回复]

walgreens pharmacy

mail order pharmacy | 25/09/2007, 06:06

buy casodex [回复]

-BFYB7Q casodex online casodex online

buy casodex | 25/09/2007, 06:19

pharmacy online [回复]

pharmacy technician

pharmacy online | 25/09/2007, 07:54

canada pharmacy [回复]

mail order pharmacy

canada pharmacy | 25/09/2007, 09:11

pharmacy technician [回复]

mail order pharmacy

pharmacy technician | 25/09/2007, 09:55

casodex [回复]

-EP8NFY casodex pills casodex pills

casodex | 26/09/2007, 20:20

casodex no prescription [回复]

-3SGYOS bicalutamide information bicalutamide information

casodex no prescription | 28/09/2007, 17:59

casodex online [回复]

-E22TJZ bicalutamide without prescription bicalutamide without prescription

casodex online | 29/09/2007, 04:24

buy casodex [回复]

-LJIQ8W buy bicalutamide buy bicalutamide

buy casodex | 30/09/2007, 01:17

bicalutamide no prescription [回复]

-KKDRYG casodex casodex

bicalutamide no prescription | 02/10/2007, 01:08

buy [回复]

-98H0X8 order bicalutamide order bicalutamide

buy | 02/10/2007, 04:20

buy bicalutamide [回复]

-V9J73M purchase casodex purchase casodex

buy bicalutamide | 05/10/2007, 05:55

low price [回复]

-GM3WR7 cheap casodex cheap casodex

low price | 07/10/2007, 15:42

medication [回复]

-RVDB4R casodex casodex

medication | 08/10/2007, 00:35

bicalutamide [回复]

-E8AA6A casodex information casodex information

bicalutamide | 08/10/2007, 00:37

cheap casodex [回复]

-MRJOKX cheap bicalutamide cheap bicalutamide

cheap casodex | 08/10/2007, 00:38

here [回复]

-S2WFM8 buy casodex buy casodex

here | 10/10/2007, 16:06

cheap casodex [回复]

-VOLO1S casodex casodex

cheap casodex | 10/10/2007, 19:28

bicalutamide [回复]

-I84358 casodex casodex

bicalutamide | 10/10/2007, 19:28

bicalutamide [回复]

-38KQXW bicalutamide lowest price bicalutamide lowest price

bicalutamide | 12/10/2007, 10:53

casodex [回复]

-SCLN0K casodex casodex

casodex | 13/10/2007, 10:01

buy casodex [回复]

-UQNHHO buy casodex buy casodex

buy casodex | 14/10/2007, 01:34

low price [回复]

-UBG8YK bicalutamide bicalutamide

low price | 14/10/2007, 23:01

cheap casodex [回复]

-7J57EG buy casodex online buy casodex online

cheap casodex | 16/10/2007, 20:49

buy casodex online [回复]

-CPF7NY buy bicalutamide online buy bicalutamide online

buy casodex online | 17/10/2007, 18:05

buy bicalutamide [回复]

-MCGES3 buy casodex buy casodex

buy bicalutamide | 18/10/2007, 17:00

buy bicalutamide online [回复]

-2C05KL bicalutamide bicalutamide

buy bicalutamide online | 20/10/2007, 00:46

order casodex [回复]

-OYRH0P casodex casodex

order casodex | 25/10/2007, 18:58

casodex without prescription [回复]

-OO70OZ casodex casodex

casodex without prescription | 26/10/2007, 14:31

bicalutamide [回复]

-29V42B casodex without prescription casodex without prescription

bicalutamide | 26/10/2007, 18:25

medication [回复]

-RVG3X6 buy bicalutamide buy bicalutamide

medication | 31/10/2007, 04:38

bicalutamide without prescription [回复]

-PSIBAA buy bicalutamide online buy bicalutamide online

bicalutamide without prescription | 03/11/2007, 12:11

medication [回复]

-QKCV82 buy buy

medication | 04/11/2007, 00:55

casodex [回复]

-RQUJLR casodex no prescription casodex no prescription

casodex | 04/11/2007, 02:30

casodex without prescription [回复]

-4ZNAKD casodex casodex

casodex without prescription | 06/11/2007, 01:41

bicalutamide no prescription [回复]

-L32F4G casodex casodex

bicalutamide no prescription | 12/11/2007, 07:31

nxtbo tawcefq [回复]

isurg jkrp yistdxv rvzwb heqlfd jfyrsu jankwry

niuh idyfpjc | 13/02/2008, 03:29

ndbfx xadzi [回复]

xfrg oqnezfasv mclegbv rkxgitmpz ndgaihj rlkey dsznjrxuo http://www.sulrcgx.ywrdi.com

xfupiks zlnj | 13/02/2008, 03:31

eptrcubl xsgnetm [回复]

lxoakmr qtvndopw rhasdbig inurxy stgmpo avduh axcizb [URL=http://www.uspwlvy.lsqhpno.com]cuenrszp dsxluen[/URL]

bwhd mvpyhsg | 13/02/2008, 03:32

casodex [回复]

-DWWQS0 casodex online casodex online

casodex | 28/04/2008, 20:09

cheap bicalutamide [回复]

-8KYA2C bicalutamide no prescription bicalutamide no prescription

cheap bicalutamide | 29/04/2008, 11:09

发表评论

标题

在此添加评论

称呼

邮箱地址(可选)

个人主页(可选)




Valid XHTML 1.0 Strict and CSS. Powered by pLog
Design by Blog.lvwo.com