How are you dynamically adding? If you add to a container that has ViewState
they should be there.
Question 2: What does your page load look like. Does it reset any page
elements.
Worst case is adding the info necessary to reconstitute a control properly
to viewstate and using the viewstate to rebuild the page. You then look in
your "property bag" for controls to render and render them from viewstate
values. One caveat, if you repaint and want the control to go away, you have
to clear it from ViewState as well.
--
Gregory A. Beamer
MVP; MCP: +I, SE, SD, DBA
*************************************************
Think outside of the box!
*************************************************
"Ben Dewey" <AspiringMVP@hotmail.comwrote in message
news:uOjv0v22GHA.4976@TK2MSFTNGP02.phx.gbl...
Quote:
Okay, so I have a base Page class called ArticlesPageBase. This base
class has reads in an overridable ArticleId and Loads the data into a
Panel object in the ContentPlaceHolder of the Master.
>
The article that it loads from the Database is a xml field that contains
html code for the article. I added some custom html to the database
article called <question id="22" />
>
When the article contains inline questions are parse out the start and
ends of the article to literal controls and do a
panel.Controls.Add(QuestionControl);
>
My problem is on PostBack my Master Article Panel container has 0
controls.
>
Is there a way to make these customer controls persist over postback? I
tried creating a List<QuestionControlsand adding to there in addition to
the panel, but I kept getting serialization errors.
>