title: How to Keep Side Navigation Bar Hidden on Post Back in C# web forms application?
body: <p>I have a C# webforms application with a side navigation bar which is shown by default ,but on click of a toggle button it gets hidden and shown when toggle button is clicked again.</p>
  
  <p>Javascript in my site.master page</p>
  
  <pre><code> $(document).ready(function () {
               if ($('#PanelState').attr('value') == 'false') {
                   $('#sidebar').addClass('hiddencol');
          }
  
      $('#sidebarCollapse').on('click', function () {
          $('#sidebar').toggleClass('active');
          if ($('#sidebar').hasClass('active')){
           $('#PanelState').attr('value', true);
           }
          else {
           $('#PanelState').attr('value', false);
          }
      });   
      });
  </code></pre>
  
  <p>CSS</p>
  
  <pre><code>   #sidebar {
      min-width: 300px;
      max-width: 300px;
      height:100vh;
      background: #158CBA;
      color: white;
      transition: all 0.3s;
  }
  
      #sidebar.active {
          margin-left: -300px;
      }
  .hiddencol {
      display: none;
  }
  </code></pre>
  
  <p>aspx hidden field</p>
  
  <pre><code>&lt;asp:hiddenfield id="PanelState" runat="server" value="true" ClientIDMode="static"   /&gt;
  </code></pre>
  
  <p>but after every post back the side navigation bar if hidden before  ,would not remain hidden </p>