ASP composite control with Datalist / Viewstate
Posted on 2004-04-20
I have a composite control that is dynamically loaded into a placeholder at runtime.
All values on the control display properly including the datalist. The datalist is not bound, one list item is manually added.
On a postback that does nothing but refresh the page all controls display with the original values except the datalist. I have a button to reload the datalist, when this is clicked, then all subsequent postbacks (refreshs of the page) retain the values in the datalist.
The datalist does seem to retain viewstate on subsequent postbacks? Instantiating the control from Init solves the problem..
However, I am generating the controls off events, I'm attempting not to use querystrings, but it may seem that is necessary.
I would except an example of how to use httpContext or other routes to capture postback information to generate the required control in the Init method.