Click here to Skip to main content
Click here to Skip to main content

How to Freeze GridView Header While Scrolling ?

, 13 Sep 2009 CPOL
Rate this:
Please Sign up or sign in to vote.
This is very common problem in Web development that we need tofreeze the GridView header at the time of scrolling, Here is one simpletips: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

License

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

Share

About the Author

Abhijit Jana
Technical Lead
India India
.NET Consultant | Former Microsoft MVP - ASP.NET | CodeProject MVP, Mentor, Insiders| Technology Evangelist | Author | Speaker | Geek | Blogger | Husband
 
Blog : http://abhijitjana.net
Web Site : http://dailydotnettips.com
Twitter : @AbhijitJana
My Kinect Book : Kinect for Windows SDK Programming Guide
Follow on   Twitter

Comments and Discussions

 
GeneralGridView With Fixed Headers in Asp.Net Using C# and jQuery PinmemberBinu198521-Jun-14 0:58 
GeneralMy vote of 5 Pinmembermandeep tondak25-Nov-12 21:08 
QuestionRequest for coming with more serious article like Desig pattern PinmemberTridip Bhattacharjee16-Apr-12 22:16 
GeneralReally helpfull PinmemberPranay Rana14-Mar-10 22:27 
GeneralRe: Really helpfull PinmvpAbhijit Jana14-Mar-10 22:35 
GeneralRe: Really helpfull PinmemberPranay Rana14-Mar-10 22:41 
hi abhijit,
 
i am also searching for this because i have no idea about this line of code. i will get back to you soon as i get information about this.
GeneralRe: Really helpfull PinmvpAbhijit Jana14-Mar-10 22:45 
GeneralRe: Really helpfull PinmemberPranay Rana14-Mar-10 23:49 
GeneralRe: Really helpfull PinmvpAbhijit Jana15-Mar-10 1:06 
GeneralRe: Really helpfull PinmemberPranay Rana15-Mar-10 1:45 
GeneralRe: Really helpfull PinmvpAbhijit Jana15-Mar-10 3:11 
GeneralRe: Really helpfull PinmemberPranay Rana16-Mar-10 0:46 
Generalisse when scrolling horizontal PinmemberPranay Rana14-Mar-10 21:11 
GeneralRe: isse when scrolling horizontal PinmvpAbhijit Jana14-Mar-10 21:32 
GeneralRe: isse when scrolling horizontal PinmemberPranay Rana14-Mar-10 21:37 
GeneralRe: isse when scrolling horizontal PinmvpAbhijit Jana14-Mar-10 21:43 
GeneralRe: isse when scrolling horizontal PinmvpAbhijit Jana14-Mar-10 22:10 

General General    News News    Suggestion Suggestion    Question Question    Bug Bug    Answer Answer    Joke Joke    Rant Rant    Admin Admin   

Use Ctrl+Left/Right to switch messages, Ctrl+Up/Down to switch threads, Ctrl+Shift+Left/Right to switch pages.

| Advertise | Privacy | Terms of Use | Mobile
Web03 | 2.8.141216.1 | Last Updated 13 Sep 2009
Article Copyright 2009 by Abhijit Jana
Everything else Copyright © CodeProject, 1999-2014
Layout: fixed | fluid