0

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....

Azhar
  • 20,500
  • 38
  • 146
  • 211
Nithesh Narayanan
  • 11,481
  • 34
  • 98
  • 138
  • I think someone has asked this already: http://stackoverflow.com/questions/157528/how-to-freeze-gridview-header – Moonshield Nov 06 '10 at 10:18

3 Answers3

1

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/

1

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.

Oakcool
  • 1,470
  • 1
  • 15
  • 33
0

You can try IdeaSparks ASP.NET CoolControls

Azhar
  • 20,500
  • 38
  • 146
  • 211