ASP.NET usercontrol: check if usercontrol is visible
<p>My question is somewhat related to this thread: <a href="http://stackoverflow.com/questions/2321177/how-to-avoid-initialization-of-web-user-control-inside-aspx">http://stackoverflow.com/questions/2321177/how-to-avoid-initialization-of-web-user-control-inside-aspx</a></p>

<p>The UserControl should only be visible when a button is clicked.
So my usercontrol is set like this:</p>

<pre><code>&lt;example:usercontrol ID="idControl" runat="server" Visible="false" /&gt;
&lt;asp:Button ID="showMyControl" runat="server" OnClick="ShowMyControl" /
</code></pre>

<p>And the usercontrol itself checks if he's visible:</p>

<pre><code>protected void Page_Load( object sender, EventArgs e ) {
    // only execute if the user control is visible
    if ( this.Visible ) {
        ...
    }
}
</code></pre>

<p>When I click the button I'm setting the property Visible of the usercontrol to true but when the postback occurs the Visible-property in the Page_Load of the usercontrol is still set to false.</p>

<p>My UserControl is probably loaded first and the Visible-property is set afterwards?
Is there an easy way to resolve this?</p>

<p>Thanks in advance!</p>
