<p>I am having a very hard time finding a standard pattern / best practice that deals with rendering child controls inside a composite based on a property value.</p>

<p>Here is a basic scenario. I have a Composite Control that has two child controls, a textbox and a dropdown. Lets say there is a property that toggles which child to render.</p>

<p>so:</p>

<pre><code>myComposite.ShowDropdown = true;
</code></pre>

<p>If true, it shows a dropdown, otherwise it shows the textbox.</p>

<p>The property value should be saved across postbacks, and the the correct control should be displayed based on the postback value. </p>

<p>Any good examples out there?</p>

I would think something like:
```
```
public bool ShowDropDown
{
    get{ return (bool)ViewState["ShowDropDown"]; }
    set{ ViewState["ShowDropDown"]; }
}

private  void Page_Load(object sender, EventArgs e)
{
    DropDaownControl.Visible = ShowDropDown;
    TextBoxControl.Visible = !ShowDropDown;
} 
/* some more code */
```
```