SitePoint Sponsor

User Tag List

Results 1 to 6 of 6
  1. #1
    SitePoint Wizard rguy84's Avatar
    Join Date
    Sep 2005
    Location
    Durham, NC
    Posts
    1,659
    Mentioned
    5 Post(s)
    Tagged
    0 Thread(s)

    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.
    Code HTML4Strict:
    <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?
    Ryan B | My Blog | Twitter

  2. #2
    SitePoint Guru Jason__C's Avatar
    Join Date
    Oct 2009
    Location
    Racoon City
    Posts
    660
    Mentioned
    1 Post(s)
    Tagged
    0 Thread(s)
    Yep. Add this to the control..

    CssClass="MyCSSClass"


    .MyCSSClass
    {
    Boo Yeah!
    }

  3. #3
    SitePoint Wizard rguy84's Avatar
    Join Date
    Sep 2005
    Location
    Durham, NC
    Posts
    1,659
    Mentioned
    5 Post(s)
    Tagged
    0 Thread(s)
    So the guy is lazy? or is there a reason for the div?
    Ryan B | My Blog | Twitter

  4. #4
    SitePoint Guru Jason__C's Avatar
    Join Date
    Oct 2009
    Location
    Racoon City
    Posts
    660
    Mentioned
    1 Post(s)
    Tagged
    0 Thread(s)
    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

  5. #5
    SitePoint Author silver trophybronze trophy
    wwb_99's Avatar
    Join Date
    May 2003
    Location
    Washington, DC
    Posts
    10,635
    Mentioned
    4 Post(s)
    Tagged
    0 Thread(s)
    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.

  6. #6
    SitePoint Wizard rguy84's Avatar
    Join Date
    Sep 2005
    Location
    Durham, NC
    Posts
    1,659
    Mentioned
    5 Post(s)
    Tagged
    0 Thread(s)
    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.
    Ryan B | My Blog | Twitter


Bookmarks

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •