Reputation: 11765
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....
Upvotes: 0
Views: 3371
Reputation: 584
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;
}
Upvotes: 1
Reputation: 1496
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.
Upvotes: 1