locked
GridView Center Certian columns? RRS feed

  • Question

  • User-905403445 posted

    How are you achieving this on the adapter examples?  I am stumped! 

    Sunday, September 16, 2007 2:26 PM

All replies

  • User923504599 posted

    The CSS is text-align: center;

    Or you can use CSS line-height to vertically center the text.

    -Damien

    Sunday, September 16, 2007 3:49 PM
  • User-905403445 posted

     I know the CSS codem but look at the source code for the example, they are only centering a few columns, right aligning a couple and I can't seem to figure out how they are targeting those columns.

     

    check it out:

    http://www.asp.net/CSSAdapters/GridView.aspx

     

    look at the source code, use web developer tools in FF to see the applied css - how is this happening? 

    Sunday, September 16, 2007 7:12 PM
  • User923504599 posted

    They aren't actually centered... The CSS for the TDs is:

    .AspNet-GridView table tbody tr td {
    background:White none repeat scroll 0%;
    border-bottom:1px solid #CCCCCC;
    border-right:1px solid #CCCCCC;
    color:#333333;
    padding:2px 20px 2px 2px;
    text-align:right;
    }
     
    The right padding gives the illusion of it being centered.
     
    If you want to center, you can apply a CSS class to the style for the given column. 
     
    -Damien
    Sunday, September 16, 2007 7:31 PM
  • User-905403445 posted

    I noticed that right after I posted, duh - what a waste of a post - thanks for trying to clue me in!

    Monday, September 17, 2007 7:54 AM
  • User923504599 posted

    Ahh, no problem!  Please set this post as answered...

    Thanks,

    -Damien

     

    Monday, September 17, 2007 8:03 AM