ASP Grid View Scroll With Header and Top Border Fixed

纵饮孤独 提交于 2019-12-13 07:09:40

问题


I have grid view which I want to scroll without scrolling header and top border. I have following css solution to scroll gridview without scrolling header row but I am not able to avoid the scrolling of top grid view border.

.HeaderFreez
{
position: relative;
top: expression(this.offsetParent.scrollTop);
z-index: 10;
}

.....
.....

<HeaderStyle CssClass="HeaderFreez" BackColor="Silver" ForeColor="Black" Font-Size="8pt"          BorderStyle="Solid" Wrap="False" />

Is there any solution to avoid the scrolling of top border of grid view in aspx ??


回答1:


You can look in to the following questions

fixing gridview header while scrolling

Grid view fixed header

similar to what you have asked for.




回答2:


You will have to create a header manually and then put it above the grid. This is the only solution.

Here are some good examples

  1. http://csharpdotnetfreak.blogspot.com/2009/07/scrollable-gridview-fixed-headers-asp.html
  2. http://aspsnippets.com/Articles/Scrollable-GridView-with-Fixed-Headers-in-ASP.Net.aspx

Similar question on SO

  1. Freeze the Header, Scroll the GridView
  2. Fixed GridView Header with horizontal and vertical scrolling in asp.net



回答3:


I tried many CSS+Javascript solutions from Git/Google/Web, etc... to use with an ASP.NET Gridview to get fixed THEAD with scrollable TBODY, but the only one that works well is Bootstrap Table. You have to include Bootstrap.



来源:https://stackoverflow.com/questions/21472554/asp-grid-view-scroll-with-header-and-top-border-fixed

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