Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

How to freeze GridView header?

As in a title, does anyone know how to freeze GridView header in ASP.NET ?

like image 206
rafek Avatar asked Oct 01 '08 13:10

rafek


4 Answers

You can do it in the css

Freeze Header: 1. Define class .Freezing in Stylesheet:

.Freezing
{
   position:relative ;
   top:expression(this.offsetParent.scrollTop);
   z-index: 10;
}   

2.Assign Datagrid Header's cssClass to Freezing

like image 171
Galwegian Avatar answered Sep 30 '22 13:09

Galwegian


Option (a) buy into a UI package that includes a souped-up GridView with this functionality built-in.

Option (b) roll your own - it's not simple. Dino Esposito has one approach.

EDIT: Just noticed that the Dino article links to a subscriber-only area on the ASPnetPro magazine site.

Here's another approach using extenders.

like image 21
Herb Caudill Avatar answered Sep 30 '22 13:09

Herb Caudill


Try this open-source project for ASP.NET. It extends GridView to provide fixed header, footer and pager and resizable column width. Works well in IE 6/7/8, Firefox 3.0/3.5, Chrome and Safari.

http://johnsobrepena.blogspot.com/2009/09/extending-aspnet-gridview-for-fixed.html

like image 22
John Avatar answered Sep 30 '22 12:09

John


I too faced a similar issue while developing in the web applications in Asp.Net 2.0 / 3.5.

One fine day, I came across IdeaSparks ASP.NET CoolControls. It helps to display fix column headers, footer and pager.

I used them personally and I really loved it!

To check the control click here : IdeaSparks ASP.NET CoolControls

Hope this helps!

like image 43
Karthik Avatar answered Sep 30 '22 12:09

Karthik