Side By Side Div Tags

Problem

Placing two div's side by side

Solution

Placing two div tags side by side isn't as easy as it perhaps should be but there's a simple solution. Give both div's a width and float them both to the left.

CSS, HTML, Design

Managing A Dynamically Added Control's State

Problem

When an ASP.Net control is added to the page dynamically (added via code rather than explicitly to the HTML) and the page is reloaded the state of the control is lost. A good example of this is when a collapsible panel extender is added dynamically. If the extender is collapsed/opened (depending on how it was orginally set up) and the page is reloaded the extender will instantly return to it's original state.

Solution

I struggled with this for quite some time and did a fair amount of searching on the internet for a solution. It turned out to be very easy to solve, all controls states are maintained automatically by the viewstate. When a control is added dynamically often the control is added at the wrong time in the page's life cycle. If you add the control during page load as I orginally did the viewstate can't reload the control's state as it's not present at that time. If you add the control during page initilization however the control is present when the viewstate attempts to reload it's control state and the control regains all of it's settings.

ASP.Net, Programming 4 Guys From Rolla