Click here to Skip to main content
15,896,382 members
Please Sign up or sign in to vote.
1.22/5 (2 votes)
See more:
how to set gridview row height same as to the linkbutton
present in gridview
Posted

Lot of ways there
Mention the height value for RowStyle(& AlternateRowStyle) in your HTML source
HTML
<rowstyle height="50" />

You can do that same in code-behind
C#
GridView1.RowStyle.Height = 50;



But my suggestion is use CSS(Best way)
CSS
.RowStyle {
  height: 50px;
}
.AlternateRowStyle {
  height: 50px;
}

HTML Source
ASP.NET
<asp:gridview id="GridView1" runat="server" xmlns:asp="#unknown">
    RowStyle-CssClass="RowStyle"  
    AlternatingRowStyle-CssClass="AlternateRowStyle">  
</asp:gridview>

OR
ASP.NET
<asp:gridview id="GridView1" runat="server" xmlns:asp="#unknown">
<rowstyle cssclass="RowStyle" />
<alternatingrowstyle cssclass="AlternateRowStyle" />
</asp:gridview>
 
Share this answer
 
You can set Height in RowStyle (and AlternateRowStyle if used). If text in your row wraps, you can avoid it using cell style white-space:nowrap;overflow:hidden;.
 
Share this answer
 
you can do this using height attribute in
HTML
<alternatingrowstyle></alternatingrowstyle>
or
HTML
<rowstyle></rowstyle>

as shown below :
XML
<AlternatingRowStyle BackColor="White" Height="50" />
           Or
<asp:BoundField ItemStyle-Height="50" ..
 
Share this answer
 
v3
Comments
Member 9391106 2-Jan-13 7:52am    
how to extend gridview row width
Change your SQL to truncate long string fields so that they don't push the row height.
 
Share this answer
 
Comments
Richard Deeming 11-Nov-15 14:35pm    
This question was asked - and answered - four years ago. Your "solution" doesn't even attempt to solve the question.

This content, along with any associated source code and files, is licensed under The Code Project Open License (CPOL)



CodeProject, 20 Bay Street, 11th Floor Toronto, Ontario, Canada M5J 2N8 +1 (416) 849-8900