I have a GridView in a div on my HTML-Code like this:
<div class="container" style="width: 80%; height: 800px; overflow: scroll">
<asp:GridView ID="GridView1" runat="server" AllowPaging="True" PageSize="40" AllowSorting="True"
AutoGenerateSelectButton="True" EnableModelValidation="False" OnPageIndexChanging="GridView1_SelectedIndexChanged"
AutoGenerateColumns="false" OnSorting="GridView1_Sorting" CssClass="mydatagrid"
PagerStyle-CssClass="pager" HeaderStyle-CssClass="headerGrida1" RowStyle-CssClass="rows"
ShowHeaderWhenEmpty="true" Font-Size="X-Small" ForeColor="Black">
The div makes it already scrollable but I also need a fixed Header of the Grid. What I tried with CSS doesnt work out...
I tried thi for the container:
.container
{
overflow: scroll;
}
.container table th
{
position: relative;
}
.container table tbody
{
overflow: hidden;
}
</style>
And this with the Gird:
.headerGrida1
{
background-color: #4a708b;
font-family: Calibri;
color: White;
border: none 0px transparent;
height: 25px;
text-align: center;
font-size: 16px;
position: relative;
}
But nothing seems to work...