Dynamic creation of child control, timing problem with events
-
Hi, I've got just one page class (aspx) which serves as the one and only base template page for the project. This page (default.aspx) now should load controls dynamically into a placeholder. Our navigation structure has 3 levels, means that we have 3 different controls which can be a part of the key what to load into the content section. Each navigation level uses the ID of the parent navigation item to decide which data should be loaded, at the end of the day the content section should load a specified UserControl. Level 1 (Products) -- Level 2 (ProductType) ----- Level 3 (ProductRating) -------- Content Frame (ProductRatingFrameControl) These given menu controls (3rd Party) use events to tell us about changed selections after a postback. But the events come very late, after OnLoad or CreateChildControls. As far as i know, it's only valid to create and add controls to a page during OnInit, CreateChildControls or OnLoad, if i try to create and add the controls in PreRender, they loose track of their ViewState stuff... So, now that's my problem, it's like a timing problem... the needed status data comes too late, i guess OnPreRender it's to late to add some dynamically created controls based on a user selction to the page, right? How can i solve such a mess? myMsg.BehindDaKeys = "Jerry Maguire";