样式ASP.NET网格视图控件
本文关键字:视图 控件 网格 NET ASP 样式 | 更新日期: 2023-09-27 18:04:35
我使用一个网格视图控件,并在代码中绑定一个数据表,我已经将页面大小设置为5。和行样式和替代行样式高度为70px。
如果我有5行在网格视图的页面显示是好的。但是如果我得到的行数少于5行,那么行就会扩展以使用可用空间。
我给网格视图设置了420px的高度。请帮帮我……样式表是这样的:
mGrid
{
border-collapse: collapse;
width: 340px;
height: 420px;
}
.mGrid .emptyrowstyle
{
height: 70px; font-size: 11px; padding: 6px 0 0 8px; border-bottom: 2px solid #fff; color:#505050;
/*line-height: 12px;*/
background: url(../townlist_bg.jpg);
}
.mGrid .alt
{
font-size: 11px; padding: 6px 0 0 8px; border-bottom: 2px solid #fff; color:#505050; height: 70px;
/*line-height: 12px;*/
background: url(../townlist_bg.jpg);
/* background-image: url('../m_images/townlist_bg.jpg');*/
}
.mGrid .pgr
{
height: 15px;
background: #424242 url(../m_images/grd_pgr.png) repeat-x top;
}
.mGrid .rowstyle
{
font-size: 11px; border-bottom: 2px solid #fff; color:#505050; background-image:url(../townlist_bg.jpg); height: 70px;
/*height: 12px;*/
/*background: #fcfcfc url(grd_alt.png) repeat-x top;*/
/*background: url(../townlist_bg.jpg); */
}
.mGrid .pgr table
{
margin: 5px 0;
}
.mGrid .pgr td
{
border-width: 0px;
padding: 0 6px;
border-left: solid 0px #666;
font-weight: bold;
color: #fff;
line-height: 12px;
}
.mGrid .pgr a
{
color: #666;
text-decoration: none;
}
.mGrid .pgr a:hover
{
color: #000;
text-decoration: none;
}
这是网格视图声明:为了简单,我没有粘贴绑定列:
CssClass="mGrid" AutoGenerateColumns="False" PageSize="5" OnPageIndexChanging="grdvListings_PageIndexChanging"rowstyle - cssclass ="rowstyle" ShowHeader ="false"AlternatingRowStyle-CssClass ="alt"PagerStyle-CssClass = " pgr ">
Thankk你
您需要从表(mGrid)中删除height样式。
如果您只希望表的高度与实际行数所指示的一样高,则应该让行高度样式决定表的高度。