Click here to Skip to main content
65,938 articles
CodeProject is changing. Read more.
Articles
(untagged)

How to Freeze GridView Header While Scrolling ?

0.00/5 (No votes)
14 Mar 2010 2  
This thing is working for both horizontal and verticle scrolling. Here id of the div is hard coded but you can use jquery to attach css class to div element. div#gridPanel { width:900px; overflow:scroll; position:relative;}div#gridPanel th{ top:...
This thing is working for both horizontal and verticle scrolling.

Here id of the div is hard coded but you can use jquery to attach css class to div element.

div#gridPanel 
{
   width:900px;
   overflow:scroll;
   position:relative;
}


div#gridPanel th
{  
   top: expression(document.getElementById("gridPanel").scrollTop-2);
left:expression(parentNode.parentNode.parentNode.parentNode.scrollLeft);
   position: relative;
   z-index: 20;
}




aspx code

<asp:Panel ID="gridPanel" runat="server" Height="200px" Width="100px" ScrollBars="Auto">
   asp.net grid view
</asp:Panel>

License

This article has no explicit license attached to it but may contain usage terms in the article text or the download files themselves. If in doubt please contact the author via the discussion board below.

A list of licenses authors might use can be found here