Freezing GridView Column Headers
Posted by Ravi Varma Thumati on May 12, 2009
For Freezing GridView Header column
Put GridView in Panel or Div Tag.
< asp:Panel runat=”server” style=”height:300px; width:700px;” >
< asp:GridView runat=”server” AllowPaging=”False” AllowSorting=”True”
AutoGenerateColumns=”False” DataKeyNames=”id” DataSourceID=”SqlDataSource1″ Width=”700px” BorderWidth=”0″ >
< Columns >
< asp:BoundField DataField=”id” HeaderText=”ID” SortExpression=”id” / >
< / Columns >
</asp:Panel>
Next create freez Css Class
Next, I created the container css style class as Mitch suggests …
/* So the overflow scrolls */
.freez {overflow:auto;}
/* Keep the header cells positioned as we scroll */
.freez table th {position:relative;}
/* For alignment of the scroll bar */
.freez table tbody {overflow-x:hidden;}
But,Problem is that it work fine in IE but not in FireFox.