设置GridView的行高 [英] To Set Row Hieght of GridView

查看:123
本文介绍了设置GridView的行高的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

大家好,

在我的应用程序中使用GridView时,我曾将数据表绑定到GriedView.但是问题是我需要减小GridView的行高.
我在Google上搜索了很多东西.每个解决方案都进行了尝试,但rowhieght仍然保持不变.我尝试过的东西如下.

1.

Hello all,

Am using GridView in my application in which I use to bound datatable to the GriedView.But the problem is that i need to reduce the row height of GridView.
i google that thing a lot.Tried each an every solution but still the rowhieght remains the same.The things that i had tried are as follows.

1.

<rowstyle backcolor="#F7F6F3" forecolor="#333333" horizontalalign="Left" Height="5px" 

  Font-Size="Medium"        />


2.

<emptydatarowstyle height="5px" />


3.

<alternatingrowstyle backcolor="White" forecolor="#284775" height="10px" />


4.

<editrowstyle backcolor="#999999" height="5%" />


单元格或行的高度仍然保持不变,即保持不变.

所以任何人都可以帮助我解决问题.


在此先感谢
Yogesh


Still the height of cells or row remain the same i.e. as it is.

So can anybody help me to tackle the problem.


Thanks in Advance
Yogesh

推荐答案

尝试为
<asp:boundfield datafield="Status" headertext="Status" xmlns:asp="#unknown">
                                    SortExpression="Status" HtmlEncode="False" ControlStyle-Width="100px" 
                                    ItemStyle-Width="200px" HeaderStyle-Height="15px">
                                  <controlstyle width="100px" />
                                    <HeaderStyle Height="15px" />
                                    <itemstyle width="200px" />
 <itemstyle width="100px" />
                                     </asp:boundfield>




我认为GridView中没有这样的高度自定义设置.
您可以通过以下方法在个人解决方案中自定义网格样式:
这些示例:

在您的客户页面中:
Hi,

I think there is no such customization of height in GridView.
You may customize the style of grid in your intire solution by doing
these example:

In your Client page:
Theme="GridSkin" EnableTheming="true"



<head id="Head1" runat="server">
    <title>Untitled Page</title>
    <link rel="stylesheet" type="text/css" href="Css/GridControlStyle.css" />
</head>

<!-- Some code here -->

<asp:GridView AutoGenerateColumns="False" ID="grdAuditTrail" runat="server"

   SkinID="skinGridView" EmptyDataText="No record.">
   <EmptyDataRowStyle ForeColor="White" />

   <!-- Some code here -->

</asp:GridView>




在您的Css/GridControlStyle.css中
里面的代码:




In your Css/GridControlStyle.css
Code inside:

.clsGridHdrSub
{
	background-color: #067ef9;
	color: White;
	font-weight: lighter;
	font-family: Verdana;
	font-size: xx-small;
	border: 0;
	text-align: justify;
}
.clsGridEmptyRow
{
	background-color: #067ef9;
	color: White;
	font-weight: 50;
	font-family: Candara;
	font-size: medium;
	border: 0;
}
.clsGridAlternate
{
	color:#031999;
	font-family:Verdana;
	font-weight:lighter;
	font-size:xx-small;
	background-color:#F0F8FF;
	
}
.clsGridAlternate:hover
{
	color:Teal;
	font-family:Verdana;
	font-weight:lighter;
	font-size:xx-small;	
	background-color: White;
	background-color:#daeeff;
}
.clsGridRow
{
	background-color:White;
	color:#031999;
	font-family:Verdana;
	font-weight:lighter;
	font-size:xx-small;
}
.clsGridRow:hover
{	
	color:#031999;
	color:Teal;		
	font-family:Verdana;
	font-weight:lighter;
	font-size:xx-small;	
	background-color: White;
	background-color:#F0F8FF;
	background-color:#daeeff;
}
.clsGridHdr
{
	color:#0453A2;
	color:White;
	font-weight:bold;
	font-family:Verdana;
	font-size:x-small;	
	background-repeat: repeat-x;
	height: 12px;
	padding: 1px 3px 1px 3px;
	border: solid 2px Black;
	font-variant:small-caps;
	background-color:#067ef9;
	background-image: url('../Images/gridheader.gif');
	background-repeat:repeat-x;
	text-decoration: none;		
}
.clsGridFtr
{
	color:#0453A2;
	font-weight:bold;
	font-family:Verdana;
	font-size:x-small;	
	background-repeat: repeat-x;
	height: 10px;
	padding: 1px 3px 1px 3px;
	font-variant:small-caps;
	text-decoration:underline;
	background-color:#f5faff;	
}
.clsGridPager
{
	color:#067ef9;
	font-weight:normal;
	font-family: Verdana;
	font-size:x-small;
	border:0;
	text-align:justify;
}





在您的App_Themes/GridSkin.skin
中 里面的代码:





In your App_Themes/GridSkin.skin
Code inside:

<asp:gridview borderwidth="1" bordercolor="White" pagesize="10" allowpaging="True" width="100%" cellpadding="5" xmlns:asp="#unknown">
    runat="server" AutoGenerateColumns="false" 
    skinID="skinGridView">
    <rowstyle cssclass="clsGridRow" horizontalalign="Left" />
    <emptydatarowstyle cssclass="clsGridEmptyRow" />
    <pagerstyle horizontalalign="Center" cssclass="clsGridPager" />
    <SelectedRowStyle BackColor="#D1DDF1" Font-Bold="True" ForeColor="#333333" />
    <HeaderStyle CssClass="clsGridHdr" ForeColor="White" />
    <footerstyle cssclass="clsGridFtr" />
    <editrowstyle backcolor="#D1DDF1" />
    <alternatingrowstyle cssclass="clsGridAlternate" />
</asp:gridview>



希望这可以帮助...

如果可以帮助,别忘了投票,以便其他人可以考虑作为答案.

问候



Hope this could help...

Do not forget to vote if could help so that others may consider as an answer.

Regards,


这篇关于设置GridView的行高的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆