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.
Who is Participating?
Anurag ThakurConnect With a Mentor Technical ManagerCommented:
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.
Question has a verified solution.

Are you are experiencing a similar issue? Get a personalized answer when you ask a related question.

Have a better answer? Share it in a comment.

All Courses

From novice to tech pro — start learning today.