fixing the header row in gridview?

☆樱花仙子☆ 提交于 2019-12-12 05:11:37

问题


I used a grid view in my project. in that i used vertical scrolls.. its work fine.

But the problem is , when i scroll down the header is also move

I want to have a fixed header provided the contents alone scroll.

please give me an advice in this regard.

I found many examples but most of them did not work for Chrome.. is there something which is universal and i can use for free....

any suggestions will be appreciated...

Thanks

<div>
<asp:Panel ID="Panel1" runat="server" Height="100px" ScrollBars="Vertical">

 <asp:GridView ID="GridView1" runat="server" AllowSorting="True" 
        AutoGenerateColumns="False" BackColor="White" BorderColor="#CCCCCC" 
        BorderStyle="None" BorderWidth="1px" CellPadding="3"  
        DataKeyNames="MachineGroupID" DataSourceID="SqlDataSource1">
        <RowStyle ForeColor="#000066" />
        <Columns>

        </Columns>
        <FooterStyle BackColor="White" ForeColor="#000066" />
        <PagerStyle BackColor="White" ForeColor="#000066" HorizontalAlign="Left" />
        <SelectedRowStyle BackColor="#669999" Font-Bold="True" ForeColor="White" />
        <HeaderStyle BackColor="#006699" Font-Bold="True" ForeColor="White" />
    </asp:GridView>
    </asp:Panel>

回答1:


Take a look at How to create an HTML table with frozen headers and columns . This is just one of many articles out there about this issue. You may need to try this or one of the other solutions people have come up with to decide which works best for you. Frozen table header inside scrollable div is another SO post on this issue.



来源:https://stackoverflow.com/questions/2405265/fixing-the-header-row-in-gridview

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!