title: How to set visibility of panel based on the cookie value
body: <p>I have a webpage that presents the user with basic information and two widget plugins; The page allows the options to show and/or hide either widgets by clicking a show/hide button (all good there). Then the user may save the page by clicking a save button that stores the page content(the master panel) into a cookie (problem here). The entire content section of the page is stored in a master panel control with the two widgets housed in a panel control of their own (see Design Code below): </p>
  
  <p>...Design:</p>
  
  <pre><code>&lt;asp:Panel ID="pnlSaveContent" runat="server"&gt; //master panel
     &lt;asp:panel ID="pnlWeatherAppCtrl" runat="server"&gt;
          &lt;div id="weatherwidget"&gt; 
            &lt;!-- the widget code for displaying the weather app --&gt;
           &lt;/div&gt;
     &lt;/panel&gt;
     &lt;asp:Panel ID="pnlStockAppCtrl" runat="server"&gt;
            &lt;div id="stockwidget"&gt;
           &lt;!-- the widget code for displaying the stock app --&gt;
             &lt;/div&gt;
     &lt;/panel&gt;
    &lt;div&gt;   &lt;!-- save button --&gt;
         &lt;asp:Button ID="savButton" runat="server" Text="Save Page" onclick="savButton_Click" /&gt;
    &lt;/div&gt;   
  &lt;/panel&gt;  &lt;!--end master panel--&gt;
  </code></pre>
  
  <p>I have the page working so that when the user clicks the show or hide button, the respective widget section become visible or invisible, but when the save button is clicked, and the page is left, then returned to, both widgets will still show. Here is my code for the save button:</p>
  
  <p>...code:   </p>
  
  <pre><code>protected void savButton_Click(object sender, EventArgs e)
      {
          HttpCookie c = Request.Cookies["preferences"];
          if (c != null)
          {
              c.Values["savePg"] = pnlSaveContent.ID;
              c.Expires = DateTime.MaxValue;
              Response.Cookies.Add(c);
          }
  
      }
  </code></pre>
  
  <p>Could someone provide some guidance as to how to set the visibility of panel based on the cookie values? Thanks</p>