如何设置gridview行高 [英] how to set gridview row height
本文介绍了如何设置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 forRowStyle
(&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 setHeight
inRowStyle
(andAlternateRowStyle
if used). If text in your row wraps, you can avoid it using cell stylewhite-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屋!
查看全文