ASP.Net Panel JQuery SlideToggle Postback
<p>I have an asp.net panel with a style which hides it and I'm using JQuery to slideToggle the panel using a hyperlink. This works fine. However, if I add a button on the page that causes a postback the panel will default back to hidden. I understand why this is happening but what is the best way to keep the panels visibility state when a postback occurs?</p>

<pre><code>&lt;head runat="server"&gt;
    &lt;title&gt;&lt;/title&gt;

    &lt;script type='text/javascript' src="jquery-1.4.1.min.js"&gt;
    &lt;/script&gt;

    &lt;style type="text/css"&gt;
        .panel
        {
            display: none;
        }
    &lt;/style&gt;

    &lt;script type="text/javascript"&gt;
        $(function() {
            $("#Link1").click(function(evt) {
                evt.preventDefault();
                $('#panelText').slideToggle('slow');
            });
        });
    &lt;/script&gt;

&lt;/head&gt;
&lt;body&gt;
    &lt;form id="form1" runat="server"&gt;
    &lt;asp:HyperLink ID="Link1" runat="server" NavigateUrl="#"&gt;SlideToggle
    &lt;/asp:HyperLink&gt;&lt;br /&gt;
    &lt;asp:Panel ID="panelText" runat="server" CssClass="panel"&gt;
        Some text&lt;/asp:Panel&gt;
    &lt;asp:Button ID="button1" runat="server" Text="Postback" /&gt;
    &lt;/form&gt;
&lt;/body&gt;
&lt;/html&gt;
</code></pre>
