|
事件執(zhí)行順序:
一、GridView 顯示綁定的數(shù)據(jù)(默認(rèn)為5行):
復(fù)制代碼 代碼如下:
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] //不管有沒有頁角行,該事件都會(huì)發(fā)生
RowDataBound
RowCreated:Pager[7]
RowDataBound
DataBound
順序如下:
DataBinding
RowCreated
RowDataBound
......
DataBound
二、GridView 點(diǎn)擊分頁按鈕時(shí)的事件發(fā)生順序:
復(fù)制代碼 代碼如下:
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
理解也就是在點(diǎn)跳頁按鈕的時(shí)候,只會(huì)綁定要顯示的頁的資料,如上,因此在RowDataBound中不會(huì)綁定所有的資料,此時(shí)去統(tǒng)計(jì),只能統(tǒng)計(jì)出當(dāng)前頁的加總(如上9-13筆的資料)
目前想來,也只有對要綁定的資料進(jìn)行統(tǒng)計(jì)了。不能在GridView中的事件中去處理。
AspNet技術(shù):asp.net Gridview行綁定事件新體會(huì),轉(zhuǎn)載需保留來源!
鄭重聲明:本文版權(quán)歸原作者所有,轉(zhuǎn)載文章僅為傳播更多信息之目的,如作者信息標(biāo)記有誤,請第一時(shí)間聯(lián)系我們修改或刪除,多謝。