开发者

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

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

上一篇:

下一篇:

精彩评论

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

最新问答

问答排行榜