gpt4 book ai didi

asp.net - 如何为asp.net中动态生成的网格行设置固定宽度和高度

转载 作者:行者123 更新时间:2023-12-04 11:27:10 26 4
gpt4 key购买 nike

我有一个 asp.net 网格 View 。这些行和列是根据从数据库中检索到的值动态生成的。在 .aspx 页面中,我使用网格<asp:GridView Height="250" Width="100%" runat="server" />如果我有更多的行数,则网格显示如下。
enter image description here
如果我只有一排网格,则如下所示。
enter image description here
但我想显示与第一张图像相同的网格行高,即使有单行。
如何将网格行高值设置为固定值。我在stackoverflow中发现了一些类似的问题。但那些并没有给我解决方案。

最佳答案

您可以使用 GridView.RowStyle Property用于定义行样式

GridView.RowStyle Property :获取对 TableItemStyle 对象的引用,该对象使您能够设置 GridView 控件中数据行的外观。

例如。

<asp:GridView ID="GridView1">
<rowstyle Height="20px" />
<alternatingrowstyle Height="20px"/>
</asp:GridView>

关于asp.net - 如何为asp.net中动态生成的网格行设置固定宽度和高度,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/13762220/

26 4 0
Copyright 2021 - 2024 cfsdn All Rights Reserved 蜀ICP备2022000587号
广告合作:1813099741@qq.com 6ren.com