2017-05-26 12 views
0

私はこのような私のHTMLコード上のdiv内のGridViewありますASP固定ヘッダ

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

をdivが、それはすでにスクロール可能になりますが、私はまた、グリッドの固定ヘッダを必要としています。 Girdと

.container 
     { 
      overflow: scroll; 
     } 
     .container table th 
     { 
      position: relative; 
     } 
     .container table tbody 
     { 
      overflow: hidden; 
     } 
    </style> 

そして、この:私は...

をうまくCSS doesntのを試してみました私は、コンテナのTHIを試してみました

.headerGrida1 
{ 
    background-color: #4a708b; 
    font-family: Calibri; 
    color: White; 
    border: none 0px transparent; 
    height: 25px; 
    text-align: center; 
    font-size: 16px; 
    position: relative; 

} 

しかし、何も動いていないようにみえ...

+0

https://stackoverflow.com/questions/19158559/how-to-fix-a-header-on-scroll – levent

答えて

0

CSSを使用する方法はありませんか?

これはPosition = absoluteまたは= fixedに切り替えるときに得られるものです。

enter image description here

唯一のものは、それがそうでなければ、誰ももうrwosを見ないだろう最初の行の上でなければならないことです。

enter image description here 多分簡単な解決策もありますか? もう1つの問題は、ヘッダーの幅が列と異なる点です。

関連する問題