Deconstructing A GridView

I am evaluating an application at work. Being a bit of a purist, I don’t think tags should be used if they don’t need to be. So when I saw the following chunk from a table I got a bit peeved.


<tr>
  <td class="gridViewRow" style="border-color:CornflowerBlue;border-width:1px;border-style:solid;">
   <div style="width:120px;text-align:center;">001950</div>
  </td><td class="gridViewRow" style="border-color:CornflowerBlue;border-width:1px;border-style:solid;">
    <div style="width:120px;text-align:center;">004075</div>
   </td><td class="gridViewRow" style="border-color:CornflowerBlue;border-width:1px;border-style:solid;">
    <div style="width:120px;text-align:center;">004654</div>
   </td><td class="gridViewRow" style="border-color:CornflowerBlue;border-width:1px;border-style:solid;">
    <div style="width:120px;text-align:center;">005536</div>
   </td><td class="gridViewRow" style="border-color:CornflowerBlue;border-width:1px;border-style:solid;">
    <div style="width:120px;text-align:center;">007761</div>
   </td>
</tr>

Is this normal or should I ask to see the control code? If I get the code, not too familar with asp.net, how far up the creek will I be?

Yep. Add this to the control…

CssClass=“MyCSSClass”

.MyCSSClass
{
Boo Yeah!
}

So the guy is lazy? or is there a reason for the div?

You might want to look at this, they are called: CSS Friendly Control Adapters…That should help you solve your problem. No, the dev isn’t lazy, but it is normal generated code. It sucks, but these Controls will help you if you want complete control over your code. I don’t blame you, I’m the same way.

Good Luck

Looks like he used the GUI features of Visual Studio to lay out that gridview. And you got GUI-designer-artifacts in the output. As pointed out, there are reasonably clean solutions out there.

I figured it was for the most part VS generated. I was curious to see how easy it could be fixed. The parts of the table I was the most worried about (not posted here), were fine. So if I could push cleaner code, I would be happy.