晨鸟科技

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

作者: Star    时间: 2010-8-31 16:48
标题: DataGrid 分页
我的参考资料在这里  http://dotnet.aspx.cc/article/b1 ... 24442808a/read.aspx, q( n  ^  E6 e7 U6 T
' }9 c0 `. x. Q; X- Z5 X9 n4 P
3个步骤:
! [# f- u3 t4 V3 S( Z6 b, L4 b1、在datagrid中添加OnPageIndexChanged事件,如OnPageIndexChanged="MyDataGrid_Page"
+ Z4 Y. ?& U4 _2、点击datagrid属性生成器,设置分页;
3 p; s1 {6 w$ `3、在相应的.cs文件中添加分页函数[attach]102[/attach]  l, r9 Z/ \7 K' s- T* _) a; d
       public void dgQuestionList_Page(object sender, DataGridPageChangedEventArgs e)
# `: |0 ]' e! \) L9 C9 i  Y- A        {
7 `  x: g1 P1 ?& j" E! y4 o# ]0 l1 d            int startIndex;
7 b/ O+ b! @$ @- q( |9 R* S) j/ \            startIndex = dgQuestionList.CurrentPageIndex * dgQuestionList.PageSize;
; ?& K" T, S) n$ K% J; q0 y' R; ~9 g            dgQuestionList.CurrentPageIndex = e.NewPageIndex;
0 R3 Z& K2 o4 o            this.QuestionListBind();% F% ~/ H% }7 K- {$ k+ c* o
        }
6 z. O2 c1 O. z/ \; ]# c) v9 N
9 a! o6 s" |3 {" |$ K然后就OK了
作者: xueshuai    时间: 2010-8-31 21:24
学习啦,楼猪辛苦啦~~




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