set gridview horizontal cell padding?

Discussion in 'ASP .Net' started by =?Utf-8?B?RGFiYmxlcg==?=, Mar 28, 2006.

  1. I need more space between my columns but increasing cellpadding increases
    vertical spacing and the gridview flows below "the fold".

    Is there some way to increase only horizontal padding? I tried setting
    padding-left/padding-right in the row style but that did nothing.

    Thanks.
    =?Utf-8?B?RGFiYmxlcg==?=, Mar 28, 2006
    #1
    1. Advertising

  2. =?Utf-8?B?RGFiYmxlcg==?=

    write2atif

    Joined:
    Apr 30, 2009
    Messages:
    1
    Use the following code in the rowdatabound event of gridview

    foreach (TableCell tCell in e.Row.Cells)
    {
    tCell.Style.Add("padding-left", "5px");
    tCell.Style.Add("padding-right", "5px");
    }

    hope it helps
    write2atif, May 18, 2009
    #2
    1. Advertising

Want to reply to this thread or ask your own question?

It takes just 2 minutes to sign up (and it's free!). Just click the sign up button to choose a username and then you can ask your own questions on the forum.
Similar Threads
  1. news.rcn.com
    Replies:
    1
    Views:
    9,629
    Chris Smith
    Jul 12, 2004
  2. Carolyn Marenger

    centering and padding in horizontal menu

    Carolyn Marenger, Mar 19, 2006, in forum: HTML
    Replies:
    7
    Views:
    849
    Jonathan N. Little
    Mar 20, 2006
  3. Ira Gladnick

    GridView cell padding as percentage?

    Ira Gladnick, Dec 19, 2006, in forum: ASP .Net
    Replies:
    2
    Views:
    415
  4. =?Utf-8?B?R3JlZw==?=

    Gridview horizonal cell spacing/padding

    =?Utf-8?B?R3JlZw==?=, Sep 7, 2007, in forum: ASP .Net
    Replies:
    2
    Views:
    820
    =?Utf-8?B?R3JlZw==?=
    Sep 7, 2007
  5. Guest
    Replies:
    2
    Views:
    1,132
    Martin Jay
    Nov 18, 2007
Loading...

Share This Page