我想用固定标头设置gridview。 [英] I want to set the gridview with fixed header.
问题描述
我尝试设计一个带有固定标题的gridview并在两侧滚动网格x& y轴。在一个表上设计gridview而不是td和tr。
请帮我解决这个问题。
@ * HTML * @
< meta charset =utf-8/>
< title>固定标题
I am try to design a gridview with fixed header and scroll the grid on both sides x & y axis. To design the gridview on one table with instead of td and tr.
Please help me out of this.
@*HTML*@
<meta charset="utf-8" />
<title>Fixed header
。
。
。
。
。
。
。
。
。
。
。
。
。
。
。
。
。
。
。
。
。
。
。
。
。
。
。
。
。
。
标题1 | < th> Header 2Header 3 | Header 25 | |
---|---|---|---|
第1行第1列 | 第1行第2列 | 第1行第3列 | 第1行第25列 |
第2行第1列 | 第2行第2列 | 第2行第3列 | 第2行第25栏 |
第3行第1行 | 第3行第2栏 | 第3行第3栏 | 第3行第25栏 |
第4行第1列 | 第4行第2列 | 第4行第3列 | 第4行第25列 |
行5 Col 1 | 第5行第2列 | 第5行第3列 | 第5行第25列 |
第6行第1列 | 第6行第2列 | 第6行第3列 | 第6行第25列 |
第7行第1列 | 第7行第2列 | 第7行第3列 | 第7行第25行 |
第8行第1列 | 第8行第2列 | 第8行第3列 | 第8行第25行 |
第9行第1列 | 第9行第2列 | 第9行第3列 | 第9行第25行 |
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
Header 1 | Header 2 | Header 3 | Header 25 | |
---|---|---|---|---|
Row 1 Col 1 | Row 1 Col 2 | Row 1 Col 3 | Row 1 Col 25 | |
Row 2 Col 1 | Row 2 Col 2 | Row 2 Col 3 | Row 2 Col 25 | |
Row 3 Col 1 | Row 3 Col 2 | Row 3 Col 3 | Row 3 Col 25 | |
Row 4 Col 1 | Row 4 Col 2 | Row 4 Col 3 | Row 4 Col 25 | |
Row 5 Col 1 | Row 5 Col 2 | Row 5 Col 3 | Row 5 Col 25 | |
Row 6 Col 1 | Row 6 Col 2 | Row 6 Col 3 | Row 6 Col 25 | |
Row 7 Col 1 | Row 7 Col 2 | Row 7 Col 3 | Row 7 Col 25 | |
Row 8 Col 1 | Row 8 Col 2 | Row 8 Col 3 | Row 8 Col 25 | |
Row 9 Col 1 | Row 9 Col 2 | Row 9 Col 3 | Row 9 Col 25 |
我尝试过:
/ * CSS * /
body {
font-family:'Segoe UI';
字体大小:15px;
}
表,th,td {
border:1px solid black;
border-collapse:collapse;
}
th,td {
padding:5px;
text-align:center;
}
thead> tr> th,
tbody> tr> td {
宽度:200px;
}
thead {
display:block;
保证金:自动;
宽度:100%;
白色空间:nowrap;
位置:相对;
溢出:自动;
文本溢出:省略号;
}
tbody {
显示:块;
保证金:-1px;
身高:200px;
溢出-y:自动;
}
.Bodytab {
white-space:nowrap;
宽度:1px;
}
What I have tried:
/*CSS*/
body {
font-family: 'Segoe UI';
font-size: 15px;
}
table, th, td {
border: 1px solid black;
border-collapse: collapse;
}
th, td {
padding: 5px;
text-align: center;
}
thead > tr > th,
tbody > tr > td {
width: 200px;
}
thead {
display: block;
margin: auto;
width: 100%;
white-space: nowrap;
position: relative;
overflow: auto;
text-overflow: ellipsis;
}
tbody {
display: block;
margin: -1px;
height: 200px;
overflow-y: auto;
}
.Bodytab {
white-space: nowrap;
width: 1px;
}
推荐答案
有N个解决方案。请查看以下示例。
在asp.net中水平和垂直滚动的固定GridView标题 - Stack Overflow [ ^ ]
There are N number of solutions.Please check the example below.
Fixed GridView Header with horizontal and vertical scrolling in asp.net - Stack Overflow[^]
这篇关于我想用固定标头设置gridview。的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!