here
.
在开发人员工具中,有一个与ASP.NET生成的表相关联的内联样式,它的width属性为100%。如果删除此项,嵌套表将弹出回其所属位置。
问题是,没有内联样式集。事实上,如果我试着
width='250px'
width='100%'
. 如果我试图删除后面代码中的width属性,
attrGridView.Attributes["Width"]
为空,正在调用
.Remove()
什么都不做。但是每个asp.net生成的gridview表都有一个内联样式
开始吧(这只会在一个地方给我带来麻烦)。
设置
table-layout='fixed'
如何使ASP.NET停止设置此属性?
一些代码:
<asp:TemplateField HeaderText="Attributes" SortExpression="Attributes">
<HeaderStyle CssClass="GridHeaderCell" />
<ItemStyle CssClass="GridTableCell AttrGridCellPadding" />
<ItemTemplate>
<asp:GridView id="attributesGridView" runat="server"
AutoGenerateColumns="false" ShowHeader="false" GridLines="None"
AlternatingRowStyle-BackColor="White" CssClass="StupidGridView" >
<EmptyDataTemplate>
<p class="italic">There are no attributes for this request.</p>
</EmptyDataTemplate>
<Columns>
<asp:TemplateField>
<ItemStyle CssClass="AttrTableCell" />
<ItemTemplate>
<asp:Label id="attributeName" runat="server"
Text='<%# Eval("Name") + ": "+ Eval("Value") %>'
CssClass="AttrGridCell"></asp:Label>
</ItemTemplate>
</asp:TemplateField>
</Columns>
</asp:GridView>
</ItemTemplate>
</asp:TemplateField>
.StupidGridView {
width: 250px;
}