title: Maintaining GridView Scroll Position and fixed header in gridview asp
body: <p>I need to keep the column headers when i scroll down and the scroll position when i e.g. do an edit and the page does a postback.</p>
  
  <p>I can't figure out how to do both things at the same time but i can do them separately. I have no idea how to do this with javascript. this is how it looks with both functions.</p>
  
  <p>I used this <a href="http://www.sergeyakopov.com/2010/11/easily-maintaining-scroll-position-in-gridview-using-jquery" rel="nofollow">link</a> for saving the scroll position and this <a href="http://www.sergeyakopov.com/2010/11/easily-maintaining-scroll-position-in-gridview-using-jquery" rel="nofollow">link</a> to keep the column headers fixed.</p>
  
  <p>As I said they each work separately but how do I combine them?</p>
  
  <pre><code>&lt;head id="Head1" runat="server"&gt;
      &lt;title&gt;Fixed Header GridView&lt;/title&gt;
      &lt;link href="Styles/GridviewScroll.css" rel="stylesheet" type="text/css" /&gt;
      &lt;script type="text/javascript" src="http://ajax.googleapis.com/ajax/libs/jquery/1.8.2/jquery.min.js"&gt;&lt;/script&gt;
      &lt;script type="text/javascript" src="http://ajax.googleapis.com/ajax/libs/jqueryui/1.9.1/jquery-ui.min.js"&gt;&lt;/script&gt;
      &lt;script src="Scripts/gridviewScroll.min.js" type="text/javascript"&gt;&lt;/script&gt;
      &lt;script type="text/javascript"&gt;
  
          $(document).ready(function () {
              gridviewScroll();
          });
  
          function gridviewScroll() {
              $('#&lt;%=GridView1.ClientID%&gt;').gridviewScroll({
                  width: 5300,
                  height: 950,
                  startHorizontal: 0,
                  wheelstep: 10,
                  barhovercolor: "#3399FF",
                  barcolor: "#3399FF"
              });
          }
  
          function scrollPosition() {
              var scroll = {
                  Y: '#&lt;%= hfScrollPosition.ClientID %&gt;'
              };
  
              $(document).ready(function () {
                  $("#scrollable-container").scrollTop($(scroll.Y).val());
              });
          }
  
  
  
         &lt;/script&gt;
  &lt;/head&gt;
  &lt;body&gt;
      &lt;form id="form1" runat="server"&gt;
              &lt;asp:GridView ID="GridView1" runat="server" Width="660px" 
                  AutoGenerateColumns="False" DataSourceID="SqlDataSource1" EnableModelValidation="True" ShowFooter="True" HorizontalAlign="Left"&gt;
                  &lt;Columns&gt;
  </code></pre>