问题
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
- http://csharpdotnetfreak.blogspot.com/2009/07/scrollable-gridview-fixed-headers-asp.html
- http://aspsnippets.com/Articles/Scrollable-GridView-with-Fixed-Headers-in-ASP.Net.aspx
Similar question on SO
- Freeze the Header, Scroll the GridView
- 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