set gridview horizontal cell padding?

G

Guest

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.
 
Joined
Apr 30, 2009
Messages
1
Reaction score
0
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
 

Ask a Question

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

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Members online

No members online now.

Forum statistics

Threads
473,995
Messages
2,570,228
Members
46,818
Latest member
SapanaCarpetStudio

Latest Threads

Top