开发者

ASP.Net - My gridview is too tall when it has very few rows

开发者 https://www.devze.com 2023-03-23 15:58 出处:网络
I am using a GridView. If my SQL Statement only returns one row, my gridview has one single row that is too tall.

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
0

精彩评论

暂无评论...
验证码 换一张
取 消