[Okta Webinar] Learn how to a build a cloud-first strategyRegister Now

x
?
Solved

How do you pad an ASP.NET GridView?

Posted on 2009-02-15
3
Medium Priority
?
456 Views
Last Modified: 2012-05-06
I have a gridview where I've left the height of each row blank.  The data inserted will determine the height.  I would like to put a little padding between each row so that the images (which are typically the tallest element in each row) don't stack on top each other.  I've attempted to define a number for CellPadding, but it doesn't seem to change anything.  Any hints?
0
Comment
Question by:kmerlo
2 Comments
 
LVL 16

Accepted Solution

by:
sunithnair earned 1000 total points
ID: 23645998
Use a style sheet and add it for each row in the gridview when it binds
<style type="text/css">
tr.addpadding
{
  padding-top:10px;
}
</style>
 
CODEBEHID
 
    protected void gvTest_RowDataBound(object sender, GridViewRowEventArgs e)
    {
        e.Row.CssClass = "addpadding";
    }

Open in new window

0
 
LVL 15

Assisted Solution

by:aibusinesssolutions
aibusinesssolutions earned 1000 total points
ID: 23646197
I would just set it in the rowstyle property of the gridview.

<style type="text/css">
.pad { padding-top: 10px; }
</style>

<asp:GridView ID="GridView1" runat="server">
        <RowStyle CssClass="pad" />
</asp:GridView>
0

Featured Post

Keep up with what's happening at Experts Exchange!

Sign up to receive Decoded, a new monthly digest with product updates, feature release info, continuing education opportunities, and more.

Question has a verified solution.

If you are experiencing a similar issue, please ask a related question

Real-time is more about the business, not the technology. In day-to-day life, to make real-time decisions like buying or investing, business needs the latest information(e.g. Gold Rate/Stock Rate). Unlike traditional days, you need not wait for a fe…
Simulator games are perfect for generating sample realistic data streams, especially for learning data analysis. It is even useful for demoing offerings such as Azure stream analytics, PowerBI etc.
Exchange organizations may use the Journaling Agent of the Transport Service to archive messages going through Exchange. However, if the Transport Service is integrated with some email content management application (such as an anti-spam), the admin…
As many of you are aware about Scanpst.exe utility which is owned by Microsoft itself to repair inaccessible or damaged PST files, but the question is do you really think Scanpst.exe is capable to repair all sorts of PST related corruption issues?
Suggested Courses

873 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question