晨鸟科技

 找回密码
 注册
搜索
查看: 11936|回复: 1
打印 上一主题 下一主题

DataGrid 分页

[复制链接]
跳转到指定楼层
楼主
发表于 2010-8-31 16:48:42 | 只看该作者 回帖奖励 |倒序浏览 |阅读模式
我的参考资料在这里  http://dotnet.aspx.cc/article/b1 ... 24442808a/read.aspx, m$ d5 C4 Y6 {7 n7 j/ |; |, H1 l: {

' [7 B. t1 }, n1 }2 e: J3 N" `' A3个步骤:
2 N/ Y% X3 L6 Q, ?9 A1、在datagrid中添加OnPageIndexChanged事件,如OnPageIndexChanged="MyDataGrid_Page"
; M) }' _# s* |4 ~2、点击datagrid属性生成器,设置分页;! K9 M+ F2 ^0 h" K# E
3、在相应的.cs文件中添加分页函数
7 x9 [& _- p' s       public void dgQuestionList_Page(object sender, DataGridPageChangedEventArgs e)( ]# p6 M; T1 o4 O5 @
        {
. U& Q* f/ E, }, b. h  d            int startIndex;
$ ]& u& s0 Q( }# {: [# Q$ ?            startIndex = dgQuestionList.CurrentPageIndex * dgQuestionList.PageSize;4 w) P7 m/ }3 y
            dgQuestionList.CurrentPageIndex = e.NewPageIndex;; m* I) ^5 H/ x8 o* y
            this.QuestionListBind();; M) |+ P$ A) O& {  l9 s8 q7 t
        }# {  S8 P0 v+ O- b( q

7 W7 O1 D2 P4 J+ O然后就OK了

本帖子中包含更多资源

您需要 登录 才可以下载或查看,没有帐号?注册

x
沙发
发表于 2010-8-31 21:24:01 | 只看该作者
学习啦,楼猪辛苦啦~~
您需要登录后才可以回帖 登录 | 注册

本版积分规则

小黑屋|手机版|晨鸟科技 ( 沪ICP备09012675号 )

GMT+8, 2025-10-29 11:19 , Processed in 6.065042 second(s), 8 queries , Wincache On.

Powered by Discuz! X3.2

© 2001-2013 Comsenz Inc.

快速回复 返回顶部 返回列表