手机
当前位置:查字典教程网 >编程开发 >asp.net教程 >asp.net Gridview行绑定事件新体会
asp.net Gridview行绑定事件新体会
摘要:在网上搜了一下事件执行顺序,并经过测试在有分页的情况下是不正确的。事件执行顺序:一、GridView显示绑定的数据(默认为5行):复制代码代...

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

事件执行顺序:

一、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中的事件中去处理。

【asp.net Gridview行绑定事件新体会】相关文章:

asp.net Execl的添加,更新操作实现代码

Asp.net 无限级分类实例代码

asp.net Repeater绑定时使用函数

asp.net button 绑定多个参数

asp.net动态加载自定义控件的方法

asp.net HTML文件上传标签

asp.net 设置GridView的选中行

asp.net webservice返回json的方法

asp.net Timer的使用方法

.net自定义事件示例分享

精品推荐
分类导航