更新时间:2023-01-24 22:47:01
那里有很多方法
在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;
.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" ..