晨鸟科技

标题: DataGrid 分页 [打印本页]

作者: Star    时间: 2010-8-31 16:48
标题: DataGrid 分页
我的参考资料在这里  http://dotnet.aspx.cc/article/b1 ... 24442808a/read.aspx
" T6 G9 T7 x: Y* i3 P
% u; O9 M" U) V: L) q3个步骤:
$ Y+ k+ c' z- w6 T2 ^! f1 W1、在datagrid中添加OnPageIndexChanged事件,如OnPageIndexChanged="MyDataGrid_Page"
' b. s) |) G  e5 E2、点击datagrid属性生成器,设置分页;9 w6 Q: K. Z9 J2 X, N8 Z! X$ Z7 i6 J1 T9 Q
3、在相应的.cs文件中添加分页函数[attach]102[/attach]* o8 I$ H; z. k. D
       public void dgQuestionList_Page(object sender, DataGridPageChangedEventArgs e)
9 u1 A, _/ b0 L0 E# T+ F( |        {
# p8 U% R" t8 ~  O            int startIndex;
5 ]' ]2 e: _: {: D0 x            startIndex = dgQuestionList.CurrentPageIndex * dgQuestionList.PageSize;; P: K+ n5 V6 z3 B
            dgQuestionList.CurrentPageIndex = e.NewPageIndex;
+ _7 f+ _) y6 w: O8 V4 l$ r            this.QuestionListBind();+ z' g- i( j. M4 i6 }( ^% e* v
        }
7 H  t& ~4 G* r) {7 ~0 c$ d, B7 S8 T# c+ t4 x" G8 k( j
然后就OK了
作者: xueshuai    时间: 2010-8-31 21:24
学习啦,楼猪辛苦啦~~




欢迎光临 晨鸟科技 (http://www.chenniao.com/cprofessor/) Powered by Discuz! X3.2