ASP.NET - freeze header in gridview - Asked By msakt on 22-May-12 03:43 AM

freeze header in gridview when scrolldown
dipa ahuja replied to msakt on 22-May-12 04:02 AM

<style type="text/css">
    border1px solid black;
  .WrapperDiv TH
  .WrapperDiv TR
    /* Needed for IE */
  function onLoad() {


Somesh Yadav replied to msakt on 22-May-12 04:17 AM


This can achieved by javascript with CSS at client side. It uses position:fixed; on CSS, so the header part will not move when you are scrolling.

Please refer to following tutorials that may meet your requirement.

Jitendra Faye replied to msakt on 22-May-12 04:25 AM
For this you need to add following css for header in GridVIew.

simply way...
<style type="text/css">
  .DataGridFixedHeader { POSITION: relative; ; TOP: expression(this.offsetParent.scrollTop); BACKGROUND-COLOR: white }
And refer this style in your ASP datagrid, by setting this value to the CSSClass property of the HeaderStyle of the datagrid. For ex:
<asp:datagrid id="resultGrid" tabIndex="-1" runat="server" Width="900px" Height="224px" BorderStyle="None"
  <HeaderStyle Font-Names="Arial" Font-Bold="True" HorizontalAlign="Center" ForeColor="White" BorderStyle="Solid"
  BorderColor="Black" VerticalAlign="Bottom" BackColor="LightSlateGray" CssClass="DataGridFixedHeader"></HeaderStyle>

ref this link...