ASP.Net - My gridview is too tall when it has very few rows
I am using a GridView
.
If my SQL Statement only returns one row, my gridview has one single row that is too tall.
If my SQL Statement returns only a few rows, my g开发者_运维技巧ridview has a few rows that are each too tall, but not nearly as tall as when only one row is returned.
If my SQL Statement returns a lot of rows, they are more normal-sized and there is no problem.
Why might my Gridview Rows change height like this based upon the quantity of rows returned?
You need to remove the Height
attribute and value from your Gridview.
Example
<asp:GridView ID="GridView1" runat="server" Height="505px" ...
Should be
<asp:GridView ID="GridView1" runat="server" ...
Alternatively, remove the CSSClass from your gridview (or remove height
from the CSS Class)
References
- WebControl.Height MSDN
- Gridview MSDN
- Similar Problem
精彩评论