Click here to Skip to main content
15,887,471 members
Please Sign up or sign in to vote.
5.00/5 (1 vote)
See more:
Hi All,

Can anyone help me in getting the fixed header for a gridview in ASP.NET.

Thanks in Advance.
Posted

 
Share this answer
 
Comments
Uday P.Singh 6-May-12 2:32am    
5!
Mohamed Mitwalli 6-May-12 2:35am    
Thanks Uday
To freeze Gridview header, try:

Step 1:
Create a CSS class as following
.HeaderFreez
{
  position:relative ;
  top:expression(this.offsetParent.scrollTop);
  z-index: 10;
}

Step 2:
Set Gridview's HeaderStyle CssClass as follows CssClass="HeaderFreez"
 
Share this answer
 
Comments
Uday P.Singh 6-May-12 2:32am    
5!
Sandeep Mewara 6-May-12 5:01am    
:)
snamyna 11-Dec-12 20:52pm    
Ok. I tried using top:expression(this.offsetParent.scrollTop);
but it turns the header fix but the gridview content flow at the back of the header.
I changed to top:expression(Sys.UI.DomElement.getBounds(document.getElementById("MainContent_pnlView")).y-25). It works perfect.

This content, along with any associated source code and files, is licensed under The Code Project Open License (CPOL)



CodeProject, 20 Bay Street, 11th Floor Toronto, Ontario, Canada M5J 2N8 +1 (416) 849-8900