这是我的 aspx:
<asp:GridView ID="GVWOReport" runat="server" DataSourceID="ldsWOReport"
onprerender="GVWOReport_PreRender" GridLines="None" CssClass="report" >
<HeaderStyle CssClass="headerRow" />
<RowStyle CssClass="row" />
<AlternatingRowStyle CssClass="altRow" />
<FooterStyle CssClass="footer" />
</asp:GridView>
这是我渲染的 HTML:
<table class="report" cellspacing="0" id="GVWOReport" style="border-collapse:collapse;">
<thead>...</thead>
<tbody>...</tbody>
</table>
我希望表标签除了我的 class 和 id 属性之外什么都没有。我发现 GridLines="None"
取消了边框,但我无法让 cellspacing
和 style
消失。
最佳答案
在设计 View 中将 CellSpacing 属性设置为 -1。这样做后我没有得到任何样式或单元格间距属性。我正在使用 asp.net 4.0。
关于asp.net - 如何在没有任何样式属性的情况下渲染 gridview ?,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/9549334/