GridView 控件事件发生顺序
2011-10-21 01:18
351 查看
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
总结:
在GridView绑定数据开始,也就是触发DataBounding事件后,这时已经把数据从数据源取出或者说已经规定了那些数据字段将会被取出,其中 的Visible属性为false的字段的值是不会从数据源中获取的。这就是为什么当GridView使用直接在html中将Visible=false 来隐藏某一列时,会得不到该列的值。然后调用RowCreated事件把一行数据全部填充到一个gridViewRow里面,然后触发 RowDataBound事件把该行绑定到GridView的Rows中。一直到最后触发GridView的DataBound来绑定显示数据。
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
总结:
在GridView绑定数据开始,也就是触发DataBounding事件后,这时已经把数据从数据源取出或者说已经规定了那些数据字段将会被取出,其中 的Visible属性为false的字段的值是不会从数据源中获取的。这就是为什么当GridView使用直接在html中将Visible=false 来隐藏某一列时,会得不到该列的值。然后调用RowCreated事件把一行数据全部填充到一个gridViewRow里面,然后触发 RowDataBound事件把该行绑定到GridView的Rows中。一直到最后触发GridView的DataBound来绑定显示数据。
相关文章推荐
- GridView 控件事件发生顺序
- GridView 控件事件发生顺序
- GridView 控件事件发生顺序
- GridView 控件事件发生顺序
- TextBox和DataGridView控件的事件发生顺序
- TextBox 控件的事件发生顺序
- GridView的 RowCreated 里不能写有关控件的客户端事件属性!!
- 关于ASPxGridView控件触发服务器端FocusedRowChanged事件的设置
- 页面装载用户控件时的事件顺序
- 控件不接收用户交互的情况以及事件响应顺序
- 如何使用 RowDataBound 事件在数据源中的字段值显示在 GridView 控件中之前修改该值
- 在GridView控件中的RowCommand事件里获得行信息的方法
- asp.net 页面从初始化到卸载事件顺序(及对页面控件调用)完整列表【转】
- 关于GridView RowUpdating事件中处理一些前台特殊控件,例如 下拉框DropDownList 等等
- GridView控件RowDataBound事件中获取列字段的几种途径
- GridView 删除按钮事件执行顺序
- listview或gridview中item的点击事件与控件点击事件冲突的解决
- 探讨为GRIDVIEW中的控件动态添加事件
- 注册ASPxGridView控件每一行的客户端onclick事件
- GridView控件RowDataBound事件中获取列字段