Question

I'm using some nested Repeaters.
The data of the inner repeaters are set in the Repeater.OnItemCreated event.

This data is relative to the SelectedDate of the Calendar.

Unfortunately, the SelectedDate is not set until somewhere before the Page_Load method is called, so I get an empty DateTime in my Repeater.OnItemCreated method.

Any idea how I can resolve this issue?

Was it helpful?

Solution

Why do you use OnItemCreated instead of OnItemDataBound? Have you disabled ViewState?

In general OnItemDataBound is the event that should be used for databinding. OnItemCreated must be used if you need to create controls dynamically since this event is triggered on every postback and not only if the repeater gets databound.

Licensed under: CC-BY-SA with attribution
Not affiliated with StackOverflow
scroll top