当前位置: 移动技术网 > IT编程>开发语言>.net > asp.net Gridview行绑定事件新体会

asp.net Gridview行绑定事件新体会

2017年12月12日  | 移动技术网IT编程  | 我要评论

师士传说无弹窗,3d教程,枞阳二三事

在网上搜了一下事件执行顺序,并经过测试在有分页的情况下是不正确的。
事件执行顺序:

一、gridview 显示绑定的数据(默认为5行):
复制代码 代码如下:

databinding
rowcreated:header[0]
rowdatabound
rowcreated:datarow[1]
rowdatabound
rowcreated:datarow[2]
rowdatabound
rowcreated:datarow[3]
rowdatabound
rowcreated:datarow[4]
rowdatabound
rowcreated:datarow[5]
rowdatabound
rowcreated:footer[6] //不管有没有页角行,该事件都会发生
rowdatabound
rowcreated:pager[7]
rowdatabound
databound

顺序如下:

databinding
rowcreated
rowdatabound
......
databound

二、gridview 点击分页按钮时的事件发生顺序:
复制代码 代码如下:

rowcommand
pageindexchanging
pageindexchanged
databinding
rowcreated:header[8]
rowdatabound
rowcreated:datarow[9]
rowdatabound
rowcreated:datarow[10]
rowdatabound
rowcreated:datarow[11]
rowdatabound
rowcreated:datarow[12]
rowdatabound
rowcreated:datarow[13]
rowdatabound
rowcreated:footer[14]
rowdatabound
rowcreated:pager[15]
rowdatabound
databound

理解也就是在点跳页按钮的时候,只会绑定要显示的页的资料,如上,因此在rowdatabound中不会绑定所有的资料,此时去统计,只能统计出当前页的加总(如上9-13笔的资料)

目前想来,也只有对要绑定的资料进行统计了。不能在gridview中的事件中去处理。

如对本文有疑问,请在下面进行留言讨论,广大热心网友会与你互动!! 点击进行留言回复

相关文章:

验证码:
移动技术网