开发者

UserControl in repeater - Child DataBind() being called before repeater OnItemDataBound

开发者 https://www.devze.com 2023-02-17 06:12 出处:网络
I am attempting to databind a user control (B) inside a repeater (R) that is开发者_如何学Python itself contained within a user control (A).

I am attempting to databind a user control (B) inside a repeater (R) that is开发者_如何学Python itself contained within a user control (A).

Page calls A.DataBind A.OnInit attaches a method to R.OnItemDataBound A.DataBind sets R.DataSource and calls R.DataBind B.DataBind is called BEFORE R.OnItemDataBound fires.

This is a problem - because I am setting B.DataSourceProperties and calling B.DataBind from R.OnItemDataBound's attached method. (Like I do whenever I nest repeaters)


Try moving your code from the repeater's ItemDataBound handler to its ItemCreated handler. I had the same problem and moving my code from ItemDataBound to ItemCreated resolved it.

0

精彩评论

暂无评论...
验证码 换一张
取 消