如何设置gridview行高 [英] how to set gridview row height

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

问题描述

如何设置gridview行高与linkbutton相同

出现在gridview

how to set gridview row height same as to the linkbutton
present in gridview

推荐答案

那里有很多方法

在HTML源代码中提及 RowStyle (& AlternateRowStyle )的高度值

Lot of ways there
Mention the height value for RowStyle(& AlternateRowStyle) in your HTML source
<rowstyle height="50" />



您可以在代码隐藏中执行相同操作


You can do that same in code-behind

GridView1.RowStyle.Height = 50;






但我的建议是使用CSS(最佳方式)




But my suggestion is use CSS(Best way)

.RowStyle {
  height: 50px;
}
.AlternateRowStyle {
  height: 50px;
}



HTML来源


HTML Source

<asp:gridview id="GridView1" runat="server" xmlns:asp="#unknown">
    RowStyle-CssClass="RowStyle"  
    AlternatingRowStyle-CssClass="AlternateRowStyle">  
</asp:gridview>






OR

<asp:gridview id="GridView1" runat="server" xmlns:asp="#unknown">
<rowstyle cssclass="RowStyle" />
<alternatingrowstyle cssclass="AlternateRowStyle" />
</asp:gridview>

您可以在 RowStyle 中设置高度(以及 AlternateRowStyle 如果使用的话)。如果行中的文本换行,则可以使用单元格样式 white-space:nowrap; overflow:hidden;
You can set Height in RowStyle (and AlternateRowStyle if used). If text in your row wraps, you can avoid it using cell style white-space:nowrap;overflow:hidden;.


you来避免它可以使用
you can do this using height attribute in
<alternatingrowstyle></alternatingrowstyle>

<rowstyle></rowstyle>



如下所示:


as shown below :

<AlternatingRowStyle BackColor="White" Height="50" />
           Or
<asp:BoundField ItemStyle-Height="50" ..


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

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