Cleaning up Default GridView Markup
I saw an interesting question today from a customer related to some of the default markup for a GridView. The following code:
<asp:GridView ID="GridView1" runat="server">
</asp:GridView>
Will generate this markup in the web page:
<table cellspacing="0" rules="all" border="1" id="GridView1" style="border-collapse:collapse;">
</table>
Adding:
CellSpacing="-1" GridLines="None"
Will clean the markup considerably generating this in the web page:
<table border="0" id="GridView1">
There currently is no way to get rid of the final Border="0" but the above technique does clean up the table considerably.