简体   繁体   中英

loading a control in the itemdatabound event of a repeater

I have a user control that i've loaded in the itemdatabound event of a repeater and the control itself doesn't seem to want to load. The page life cylce seems to be the page that has the itemdatabound event then the user control so the control loads too late. I need to access properties from my control in the itemdatabound event.

Does anybody know how this can get done?

thanks!

Have you tried overriding OnInit on your page, and then databinding your repeater in there ?

Usually you want to add controls dynamically whilst in OnInit, since otherwise you're too late in the life cycle (as you point out yourself).

If you're already databinding in OnInit, it should work.

Preferably post your ItemDataBound event and where you databind the repeater (the code) :-)

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM