[Okta Webinar] Learn how to a build a cloud-first strategyRegister Now

  • Status: Solved
  • Priority: Medium
  • Security: Public
  • Views: 971
  • Last Modified:

Freezing gridview header in a fixed width div

I have seen some gridview freezing header examples on the web but I have a special case where the gridview is in a fixed width div. The examples I tried make the header fixed but the full width of the header is shown and it overflows out of the div while the grid body has a horizontal scroll bar.

I need it to:
1- Header and tbody scroll together horizontally and both confined in the fixed width div.
2- Header is fixed while gridview body scrolls vertically.
3- Don't want to use a commercial grid.
4- I am using IE only. Don't care if it works in FF, Opera, ..etc.
1 Solution
Anurag ThakurCommented:
you cannot fix the gridview hader and make the content scrollable but the functionality can be created in another way and the way is first creating a table row in you put the TD's in which you add asp:labels and then format as they are the headers. In you grid you set the showheader = false and allign all the columns of the grid to the width of the TD's width

in this way you can implement horizontal scroll and vertical scrol in the grid while your header is at the top
dont foreget to implement the emptydatatext property of the gridview
jentel2Author Commented:

This is a requirement which I don't anymore. I am accepting your solution without actually trying it out.

Featured Post

Free Tool: Subnet Calculator

The subnet calculator helps you design networks by taking an IP address and network mask and returning information such as network, broadcast address, and host range.

One of a set of tools we're offering as a way of saying thank you for being a part of the community.

Tackle projects and never again get stuck behind a technical roadblock.
Join Now