Note that there are some explanatory texts on larger screens.

plurals
  1. PO
    text
    copied!<p>First, you need to create a client side (JavaScript) <code>onClick</code> event for the panel or control users are clicking on.</p> <p>So, go in there type <code>onClick="functionName();"</code></p> <pre><code>&lt;asp:Panel ID="pDocumentHeaderTitle" runat="server" CssClass="collapsePanelHeader" onClick="setCollapseState();"&gt; &lt;asp:Image ID="imgDocumentHeaderHeader" runat="server" ImageUrl="~/images/wadown.gif"/&gt;Document Header &lt;asp:Label ID="lblDocumentHeaderHeader" runat="server"&gt;(Show)&lt;/asp:Label&gt; &lt;/asp:Panel&gt; </code></pre> <p>Next: Add this javascript.</p> <pre><code>&lt;script type="text/javascript"&gt; function setCollapseState() { var extenderDocumentHeader = document.getElementById("MainContent_cpeDocumentHeader_ClientState"); setCookie("cpeDocumentHeaderStatus", extenderDocumentHeader.value, 5) } //W3Schools cookie code. function setCookie(c_name, value, exdays) { var exdate = new Date(); exdate.setDate(exdate.getDate() + exdays); var c_value = escape(value) + ((exdays == null) ? "" : "; expires=" + exdate.toUTCString()); document.cookie = c_name + "=" + c_value; } //W3Schools cookie code. function getCookie(c_name) { var i, x, y, ARRcookies = document.cookie.split(";"); for (i = 0; i &lt; ARRcookies.length; i++) { x = ARRcookies[i].substr(0, ARRcookies[i].indexOf("=")); y = ARRcookies[i].substr(ARRcookies[i].indexOf("=") + 1); x = x.replace(/^\s+|\s+$/g, ""); if (x == c_name) { return unescape(y); } } } &lt;/script&gt; </code></pre> <p>Notice, when your page is loaded, there is a hidden field that is your collapsible panels state. It will be true or false. Go to page source and search for it you will find it.</p> <p>Then add:</p> <p><code>var extenderDocumentHeader = document.getElementById("MainContent_cpeDocumentHeader_ClientState");</code></p> <p>So on click, get this clients state, save it in a cookie and your good to go!</p>
 

Querying!

 
Guidance

SQuiL has stopped working due to an internal error.

If you are curious you may find further information in the browser console, which is accessible through the devtools (F12).

Reload