UserControl in repeater - Child DataBind() being called before repeater OnItemDataBound
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.
精彩评论