Jason Rae
Jason Rae

Reputation: 2663

Div produced from an ASP.Net GridView is too large

I have an ASP.Net GridView with properties like so:

<asp:GridView ID="grdOrderEntry" runat="server" AutoGenerateColumns="false" ShowFooter="True"
                                    DataKeyNames="oid" Height="100%">

When I view the control in the browser, there is a lot of white space after the control. When viewing the HTML, the div that is produced by the GridView is much larger than the control, causing the whitespace. Is there a property I can set on the GridView to make the div as small as possible?

Upvotes: 1

Views: 764

Answers (2)

Evert
Evert

Reputation: 8541

I suspect this is being caused by your Height="100%" attribute, remove that, and it should just stretch around the table it contains (unless there is some css other style added to it as well).

Upvotes: 2

Antony Scott
Antony Scott

Reputation: 21998

If you set the CssClass property you will be able to create some css to address the problem. I would recommend using a live css editor so you can mess around with it until you get the desired effect.

Upvotes: 3

Related Questions