views:

41

answers:

1

By default, it seems that the GridView spits out <table style="width:100%"...>, which I don't want. I would like not to specify width at all, in which case the browser will figure out how wide the table needs to be.

How can I do this?

+1  A: 

All the ASP.NET controls modify their html output based on the browser that is viewing the page. For instance, if I add a GridView without any properties to my page:

<asp:GridView ID="myGrid" runat="server"></asp:GridView>

I get the following html generated for IE7:

<table cellspacing="0" rules="all" border="1" id="myGrid" style="border-collapse:collapse;">

Due to company policies, I don't have any other browsers installed, so I cannot test to see if a width value is generated for different browsers. I only get a width value if I explicitly set a Width in the GridView declaration.

Jason Berkan
thx, I am using Chrome. Maybe I should check IE.
AngryHacker