65.9K
CodeProject is changing. Read more.
Home

How to Freeze GridView Header While Scrolling ?

Sep 13, 2009

CPOL
viewsIcon

151842

This is very common problem in Web development that we need to freeze the GridView header at the time of scrolling, Here is one simple tips: Step 1 : Create a CSS class as following .HeaderFreez  {  position:relative ;   top:expression(this.offsetParent.scrollTop);  z-index: 10;  }   .HeaderFr

This is very common problem in Web development that we need to freeze the GridView header at the time of scrolling, Here is one simple tips:
Step 1 : Create a CSS class as following
  1. .HeaderFreez  
  2. {  
  3. position:relative ;   
  4. top:expression(this.offsetParent.scrollTop);  
  5. z-index10;  
  6. }   

Step 2 Set Gridview’s HeaderStyle CssClass as follows
CssClass="HeaderFreez"
That’s all. Some times we need also maintain the scroll positions while selecting any data from GridView, and quite difficult to maintain the position while we are using AJAX, I have written a complete article on that, hope this will help Maintain GridView Scroll Position inside updatepanel