开发者

How to prevent the GridView from sptting out the width attribute?

开发者 https://www.devze.com 2022-12-10 04:46 出处:网络
By default, it seems that the Gr开发者_如何学CidView 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 figur

By default, it seems that the Gr开发者_如何学CidView 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?


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.

0

精彩评论

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