GridView 控件事件发生顺序
2007-12-19 12:44
489 查看
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 控件的事件发生顺序
- TextBox和DataGridView控件的事件发生顺序
- ASP.NET2.0中的GRIDVIEW控件在使用TemplateField中的LinkButton时如何在RowCommand事件中找到当前行index的方法
- GridView是ASP.NET中功能强大的数据显示控件,它的RowDataBound事件为我们提供了方便的控制行、列数据的途径。
- Listview中加入gridview发生事件冲突
- 窗口事件的发生顺序
- GridView控件RowDataBound事件中获取列字段的几种途径
- asp.net 页面从初始化到卸载事件顺序(及对页面控件调用)完整列表【转】
- 如何在GridView的OnRowCommand事件 用FindControl找到模版控件?
- GridView控件RowDataBound事件中获取列字段的几种途径
- RecyclerView的基本用法 (一个控件实现ListView, GridView等效果)+接口回调点击事件
- [原创]GridView各事件获取处理行索引及该行控件方法
- jQuery学习笔记---阻止事件发生及事件发生顺序及表单提交示例应用
- ASP.NET中GridView控件的几个事件的使用
- 扩展GridView控件(6) - 响应行的单击事件和双击事件
- GridView 事件顺序大全