How to define CellPadding in GridView in ASP.NET

前端 未结 3 1933
难免孤独
难免孤独 2021-02-20 05:55
  • I autoformat a GridView in ASP.NET.
  • It looks nice but the headers all run together like this:

    idfirstNamelastNameage

  • I

相关标签:
3条回答
  • 2021-02-20 06:19

    You should set a cssclass and use css to control it. The only property of a table you cant fully control cross browser with css is cellspacing.

    .myTableClass tr th {
        padding: 5px;
    }
    
    0 讨论(0)
  • 2021-02-20 06:30

    Check the generated HTML and find the table it has created. Check the ID of the table. With the id, add following lines to your CSS. This worked for me when all else failed..

    #YourTableIdFoo th , #YourTableIdFoo td 
    {
        padding-right:      1em;
    }
    
    0 讨论(0)
  • 2021-02-20 06:39

    GridView also has a property "CellPadding" and "CellSpacing" that can help us do this.

    0 讨论(0)
提交回复
热议问题