Fixed Header Gridview with scrollable body in asp.net

I have a grid-view placed inside a div and scroll bar is there. I want to set the grid view header fixed and while scrolling only the content will be scrollable. How can do this.... Thanks in Advance....

Answers


in C# after gridview bind GVBrand.HeaderRow.TableSection = TableRowSection.TableHeader;

add follwoing css in gridview

    table {
        width: 100%;
    }

    thead, tbody, tr, td, th { display: block; }

    tr:after {
        content: ' ';
        display: block;
        visibility: hidden;
        clear: both;
    }

    thead th {
        height: 30px;

        /*text-align: left;*/
    }

    tbody {
        height: 120px;
        overflow-y: auto;
    }

    thead {
        /* fallback */
    }


    tbody td, thead th {
        width: 19.2%;
        float: left;
    }

http://jsfiddle.net/T9Bhm/7/


Try doing the following.

Hide the header Configure the div, so you have the side bar Add on top of the div another div, with the column names

Don't forget to fix the column sizes and have them the same as the column names on top.


Need Your Help

RegEx Backreferences

php regex pcre backreference

Having the following regular expression:

PHP email script just opens PHP file

php html linux forms apache

I'm hosting a website on a Linux server, running Ubuntu Server 11.04 (32 bit). The web server is Apache. One of the pages on the site has a form with the submit linking to a PHP email script. Form ...

About UNIX Resources Network

Original, collect and organize Developers related documents, information and materials, contains jQuery, Html, CSS, MySQL, .NET, ASP.NET, SQL, objective-c, iPhone, Ruby on Rails, C, SQL Server, Ruby, Arrays, Regex, ASP.NET MVC, WPF, XML, Ajax, DataBase, and so on.