문제

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?

도움이 되었습니까?

해결책

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.

라이센스 : CC-BY-SA ~와 함께 속성
제휴하지 않습니다 StackOverflow
scroll top