如何在div滚动中冻结gridview标头? [英] how do I freeze gridview header within a div scrolling?
本文介绍了如何在div滚动中冻结gridview标头?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!
问题描述
嗨成员我在div中有一个网格视图,它是启用滚动的div。 但是我想知道如何在滚动时冻结标题?我希望标题仍然保留在div中,因此需要启用x&我滚动,因为我有很多列。我不介意它是滚动的div还是滚动的网格视图。
Hi member I have a grid view inside a div which is the div that enable the scrolling as of now. However I would like to know how do I freeze the header while scrolling? I would like the header to still stay within the div thus there is a need to enable x & y scrolling as I do have many columns. I do not mind if its the div that scrolls or the grid view that scrolls.
<div style="width: 100%; height: 400px; overflow: auto" >
<asp:GridView ID="Gridview1" runat="server" AllowSorting="True" AutoGenerateColumns="False" Width="100%" GridLines="Horizontal" BorderStyle="Solid" OnRowDataBound ="Gridview1_OnRowDataBound">
<AlternatingRowStyle BackColor="White" />
<columns>
<asp:boundfield DataField="Columm1" HeaderText="Columm1"></asp:boundfield>
<asp:boundfield DataField="Columm2" HeaderText="Columm2"></asp:boundfield>
<asp:boundfield DataField="Columm3" HeaderText="Columm3"></asp:boundfield>
<asp:boundfield DataField="Columm4" HeaderText="Columm4"></asp:boundfield>
<asp:boundfield DataField="Columm5" HeaderText="Columm5"></asp:boundfield>
<asp:boundfield DataField="Columm6" HeaderText="Columm6"></asp:boundfield>
<asp:boundfield DataField="Columm7" HeaderText="Columm7"></asp:boundfield>
<asp:boundfield DataField="Columm8" HeaderText="Columm8"></asp:boundfield>
<asp:boundfield DataField="Columm9" HeaderText="Columm9"></asp:boundfield>
</columns>
<EditRowStyle BackColor="#2461BF" />
<HeaderStyle BackColor="#507CD1" Font-Bold="False" ForeColor="Black" BorderStyle="Solid" BorderWidth="2px" />
</asp:GridView>
</div><br />
推荐答案
你可以在这里找到例子
带固定标题和滚动条的网格视图 [ ^ ]
问候,
you can find example here
GridView with Fixed Header and Scroll Bar[^]
Regards,
这篇关于如何在div滚动中冻结gridview标头?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!
查看全文