我有以下gridview。没有错误,但是当我使用 w3c 验证器验证页面并且不存在任何行时,colspan 属性会获取 gridview 中已定义列的数量的值。当没有行时,我们有没有机会让 gridview 删除 colspan 属性?
<asp:GridView ID="gv1" AutoGenerateColumns="False" ShowFooter="true" runat="server"
AllowSorting="true" AllowPaging="true" CssClass="gridview" OnDataBound="gv_DataBound"
OnRowDataBound="gv_RowDataBound" DataKeyNames="id" CellSpacing="-1" GridLines="None"
EmptyDataText="no reference substances linked!">
<Columns>
<asp:HyperLinkField DataTextField="name" HeaderText="reference substance" DataNavigateUrlFormatString="~/ReferenceSubstances/{0}.aspx"
DataTextFormatString="{0}" Target="_self" DataNavigateUrlFields="id" SortExpression="name" />
<asp:BoundField DataField="supplier" HeaderText="supplier" SortExpression="supplier" />
<asp:BoundField DataField="supplier_code" HeaderText="supplier code" SortExpression="supplier_code" />
<asp:BoundField DataField="lot" HeaderText="lot" SortExpression="lot" />
</Columns>
<PagerStyle CssClass="footer" />
<PagerTemplate>
<asp:GridViewPager ID="GridViewPager1" runat="server" />
</PagerTemplate>
</asp:GridView>