晨鸟科技

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

作者: Star    时间: 2010-8-31 16:48
标题: DataGrid 分页
我的参考资料在这里  http://dotnet.aspx.cc/article/b1 ... 24442808a/read.aspx
, z. L( B- d, k! n* n6 s8 i2 d) g' F  i, m7 A9 \* Q
3个步骤:5 e2 `+ C6 X7 @5 _6 k7 s- C
1、在datagrid中添加OnPageIndexChanged事件,如OnPageIndexChanged="MyDataGrid_Page"( y+ q3 [  f4 T, T
2、点击datagrid属性生成器,设置分页;
5 S5 {9 P9 P* B: W' f3、在相应的.cs文件中添加分页函数[attach]102[/attach]; ^# L' c7 T+ P! W/ [
       public void dgQuestionList_Page(object sender, DataGridPageChangedEventArgs e)
: u( w# ?6 `( ?' j9 \) f1 |4 X; D        {% D5 w+ s5 r+ I8 n" O+ ]
            int startIndex;
$ \, ]; y2 h9 D& h, U+ K            startIndex = dgQuestionList.CurrentPageIndex * dgQuestionList.PageSize;
! v1 |9 a" O* |5 N$ X0 N' J            dgQuestionList.CurrentPageIndex = e.NewPageIndex;- ?& \8 s- n2 ?7 b/ t8 d& K1 t1 E0 ^
            this.QuestionListBind();
( \0 b, I3 s: ^, B        }( |& q. @. P; \2 y$ K, |
/ e# A% V6 A8 s% S/ I6 n( U6 Q
然后就OK了
作者: xueshuai    时间: 2010-8-31 21:24
学习啦,楼猪辛苦啦~~




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