How to set fixed width and height for grid row which is dynamically generating in asp.net

asp.net

Solution

You can use `GridView.RowStyle Property` for defining the row style

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.

Eg.

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

Problem

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.

Original source