Warning: file_get_contents(/data/phpspider/zhask/data//catemap/1/asp.net/36.json): failed to open stream: No such file or directory in /data/phpspider/zhask/libs/function.php on line 167

Warning: Invalid argument supplied for foreach() in /data/phpspider/zhask/libs/tag.function.php on line 1116

Notice: Undefined index: in /data/phpspider/zhask/libs/function.php on line 180

Warning: array_chunk() expects parameter 1 to be array, null given in /data/phpspider/zhask/libs/function.php on line 181
C# 设置ASP.NET网格视图控件的样式_C#_Asp.net - Fatal编程技术网

C# 设置ASP.NET网格视图控件的样式

C# 设置ASP.NET网格视图控件的样式,c#,asp.net,C#,Asp.net,我正在使用一个网格视图控件,并在后面的代码中将datatable绑定到此控件,我已将页面大小设置为5。行样式和备用行样式高度为70px 如果我在grid view页面中有5行,那么显示就可以了。但是,如果我得到的行数少于5行,则行数将展开以使用aviable spce 我已将网格视图的高度设置为420px。请帮帮我 样式表如下所示: mGrid { border-collapse: collapse; width: 340px;

我正在使用一个网格视图控件,并在后面的代码中将datatable绑定到此控件,我已将页面大小设置为5。行样式和备用行样式高度为70px

如果我在grid view页面中有5行,那么显示就可以了。但是,如果我得到的行数少于5行,则行数将展开以使用aviable 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;
    }
这是网格视图声明:为了简单起见,我不粘贴数据绑定列:

CssClass=“mGrid”AutoGenerateColumns=“False”PageSize=“5”OnPageIndexChanging=“grdvListings\u PageIndexChanging” RowStyle CssClass=“RowStyle”ShowHeader=“false” AlternatingRowStyle CssClass=“alt” PagerStyle CssClass=“pgr”>


谢谢

您需要从表中删除高度样式(mGrid)

如果只希望表格的高度与实际行数相同,则应让行的高度样式确定表格的高度