[英]Styling ASP.NET Grid View Control
我正在使用Grid View控件,並在我將頁面大小設置為5的代碼中將數據表綁定到此。 並將行樣式和備用行樣式的高度設置為70px。
如果我在網格視圖頁面中有5行,則顯示正常。 但是如果我少於5行,則行會擴展以使用可用的spce。
我已將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;
}
這是Grid視圖的聲明:為了簡單起見,我沒有粘貼數據綁定的列:
CssClass =“ mGrid” AutoGenerateColumns =“ False” PageSize =“ 5” OnPageIndexChanging =“ grdvListings_PageIndexChanging” RowStyle-CssClass =“ rowstyle” ShowHeader =“ false” AlternatingRowStyle-CssClass =“ alt” PagerStyle-CssClass =“ pgr”>
謝謝你
您需要從表(mGrid)中刪除高度樣式。
如果僅希望表的高度與實際行數一樣高,則應讓行的高度樣式確定表的高度。
聲明:本站的技術帖子網頁,遵循CC BY-SA 4.0協議,如果您需要轉載,請注明本站網址或者原文地址。任何問題請咨詢:yoyou2525@163.com.