Freezing gridview header in a fixed width div

Posted on 2008-11-04
Last Modified: 2010-05-18
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.
Question by:jentel2
    LVL 26

    Accepted Solution

    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

    Author Comment


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

    Featured Post

    Threat Intelligence Starter Resources

    Integrating threat intelligence can be challenging, and not all companies are ready. These resources can help you build awareness and prepare for defense.

    Join & Write a Comment

    In an ASP.NET application, I faced some technical problems. In this article, I list them out and show the solutions that I found.  I hope it will be useful. Problem: After closing a pop-up window, the parent page should be refreshed automaticall…
    Problem Hi all,    While many today have fast Internet connection, there are many still who do not, or are connecting through devices with a slower connect, so light web pages and fast load times are still popular.    If your ASP.NET page …
    To add imagery to an HTML email signature, you have two options available to you. You can either add a logo/image by embedding it directly into the signature or hosting it externally and linking to it. The vast majority of email clients display l…
    Illustrator's Shape Builder tool will let you combine shapes visually and interactively. This video shows the Mac version, but the tool works the same way in Windows. To follow along with this video, you can draw your own shapes or download the file…

    731 members asked questions and received personalized solutions in the past 7 days.

    Join the community of 500,000 technology professionals and ask your questions.

    Join & Ask a Question

    Need Help in Real-Time?

    Connect with top rated Experts

    16 Experts available now in Live!

    Get 1:1 Help Now