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.
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
The following source code will show how to display a frozen header and scrollable data in GridView.
C# Source Code
VB.Net Source Code
- ASP.NET Simple GridView
- Sorting , Paging and AutoGenerateColumns
- ASP.NET GridView Editing
- ASP.NET GridView Delete
- DropDownList in GridView
- Create Gridview at runtime
- Gridview - Add, Edit and delete
- Gridview export to Excel
- Gridview export to CSV
- GridView summary on Footer
- Subtotal row in Gridview
- SubTotal and GrandTotal in GridView
- Create Gridview without database
- GridView from Stored Procedure
- How to create Gridview Popup Form
- How to create a Blank row in gridview
- Nested GridView in ASP.NET
- Auto Generate Row Number in GridView
- Image between GridView rows
- How to select a row in gridview
- Checkbox in ASP.NET GridView Control