Melursus Melursus - 3 years ago 135
ASP.NET (C#) Question

Asp.Net GridView Remove Html Styling

When I'm using a grid view in Asp.Net, its auto-generated this ugly Html style : cellspacing="0" rules="all" border="1"

Is there a way to not have this styling at all ?


Presently what I got is :

<table cellspacing="0" rules="all" border="1" id="ctl00_cphMain_gvTest" style="border-collapse:collapse;">

What I want :

<table id="ctl00_cphMain_gvTest">

So, no Html style at all. I want clean Html, I'll use CSS if I want to add style...

Answer Source

Take a look at the CSS friendly ASP.NET 2.0 Control Adapaters on the ASP.NET website.

It not only strips out most of the ugly attributes but also adds thead and tbody tags.

Recommended from our users: Dynamic Network Monitoring from WhatsUp Gold from IPSwitch. Free Download