如何设置网格行是动态的asp.net生成固定的宽度和高度 [英] How to set fixed width and height for grid row which is dynamically generating in asp.net
问题描述
我有一个asp.net网格视图。此行和列被动态地生成基于从数据库中检索到的值。在.aspx页面中我用网< ASP:GridView的HEIGHT =250WIDTH =100%=服务器/>
I have one asp.net grid view. This rows and columns are dynamically generating based on the retrieved values from database. In .aspx page i use grid
<asp:GridView Height="250" Width="100%" runat="server" />
如果我的行数越多则网格是出现如下图所示。
If I have the more number of rows then The grid is appearing like below.
如果我只有一排电网出现如下图所示。
If I have only one row grid is appearing like below.
但我想显示网格行的高度一样的第一幅图像,即使有单排。
如何为固定设置网格行高值。我发现在计算器这样一些类似的问题。但这些并没有给我的解决方案。
But I want to show the grid rows height same as first image even if there is single row. How to set the grid row height values as fixed. I found some similar questions like this in stackoverflow. But those didn't give me the solution.
推荐答案
您可以使用 GridView.RowStyle地产
用于定义行样式
You can use GridView.RowStyle Property
for defining the row style
GridView.RowStyle物业:获取对TableItemStyle对象,使您可以设置数据行的外观GridView控件参考
GridView.RowStyle Property: Gets a reference to the TableItemStyle object that enables you to set the appearance of the data rows in a GridView control.
例如:
<asp:GridView ID="GridView1">
<rowstyle Height="20px" />
<alternatingrowstyle Height="20px"/>
</asp:GridView>
这篇关于如何设置网格行是动态的asp.net生成固定的宽度和高度的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!