Chinaunix首页 | 论坛 | 博客
  • 博客访问: 226550
  • 博文数量: 59
  • 博客积分: 3000
  • 博客等级: 中校
  • 技术积分: 1340
  • 用 户 组: 普通用户
  • 注册时间: 2006-02-14 09:50
文章分类

全部博文(59)

文章存档

2009年(2)

2008年(57)

我的朋友
最近访客

分类:

2008-10-24 16:33:22

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来绑定显示数据。
阅读(405) | 评论(0) | 转发(0) |
给主人留下些什么吧!~~