Why Repeater.ItemCreated is fired before Page_Load on postback

  • Thread starter Thread starter Philippe Camus
  • Start date Start date
P

Philippe Camus

I didn't find any documentation about this behaviour.
On postbacks the Repeater ItemCreated event is fired before Page_Load event
It occurs for each item with empty RepeaterItemEventArgs.Item.DataItem.

Does anybody know more about this strange behaviour?

Thanks

Philippe
 
ItemCreated is used on postback to recreate the repeater from the viewstate.
It's normal that DataItem is going to be null. When the repeater is
initially bound, it won't be null because there's an actual underlying
datasource. Since the viewstate is used to rebuild it on postback, and not
the datasource (which is lost), DataItem is null.

I believe, but am not sure, that on postback ItemCreated is called by either
the LoadViewState or PorcessPostbackData page events - both of which happen
before Load.

Karl
 
Back
Top