Freeze Gridview Header row, Scroll in GridView

How to Freeze GridView Header Row ?

The GridView control, you could display an entire collection of data, easily add sorting and paging, and perform inline editing. Sometimes, we need to present a large collection of data in a GridView and that too in a small space or portion of web form. When gridview is made scrollable, headers will also scroll along with the other gridview contents making it difficult for the user to understand the data properly. In this situations we can freeze the header row then the user can scroll the data and see the header as fixed.

freeze gridview row


In this article I have used Microsoft's Pubs database for sample data. You can download it free from the following link.


Freeze Gridview Row

Here we set GridView ShowHeader = "false" and make a separate header for the GridView by using HTML Table and places the GridView just below the Table. So the header row is always fixed there and we can scroll the GridView and see the data.

How to scroll gridview data ?

Here the program places the GridView inside a Div and fixed the Div height. So the entire GridView data we can see it inside the Div by scrolling.

Adding scrollbar to GridView

adding scrollbar to gridview

The following source code will show how to display a frozen header and scrollable data in GridView.


C# Source Code

VB.Net Source Code (C) 2021    Founded by raps mk
All Rights Reserved. All other trademarks are property of their respective owners.
SiteMap  | Terms  | About