Why Repeater.ItemCreated is fired before Page_Load on postback

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
 
K

Karl Seguin [MVP]

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
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Members online

Forum statistics

Threads
473,764
Messages
2,569,566
Members
45,041
Latest member
RomeoFarnh

Latest Threads

Top