Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations SkipVought on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

cell padding in an ASP .NET datagrid

Status
Not open for further replies.

KnotGoblin

Technical User
Jan 4, 2005
77
0
0
US
I am try to change the cell padding and font size of a table generated by an ASP .NET datagrid control.

I am using the following my css:
Code:
#dgdJobs TD
{
    font-size: 85%;
    padding: 1px 2px 1px 2px;
}
This same thing works for another page.

ASP is not changing the table ID. I've checked that.

The only difference I can find, which I'm guessing my be the case, is that (for some unknown reason) ASP is putting <span>'s around contains of the cells in this table (not the others)? could the <span>'s be causing the style not to be applied to the <TD>?

here's an example of what ASP .NET is generating:
Code:
<tr class="dgRow">
    <td nowrap="nowrap" align="Center">
        <a href="panels.aspx?job=1236">1236</a>
    </td>
    <td>
        <span>Nissan, Smyrna, TN</span>
    </td>
...
</tr>

-Jer
 
The spans make no difference as far as I can tell.

The following code, made from your own seems to work fine for me in IE6.

Code:
<?xml version="1.0" encoding="iso-8859-1"?>
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "[URL unfurl="true"]http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">[/URL]
<html xmlns="[URL unfurl="true"]http://www.w3.org/1999/xhtml">[/URL]
<head>
<title>Untitled Document</title>
<meta http-equiv="Content-Type" content="text/html; charset=iso-8859-1" />

<style type="text/css">
	td {
		border:1px solid black;
		padding:1px 5px 1px 2px;
	}
</style>
</head>

<body>
<table style="border:1px solid black;">
<tr class="dgRow">
    <td nowrap="nowrap" align="Center">
        <a href="panels.aspx?job=1236">1236</a>
    </td>
    <td>
        <span>Nissan, Smyrna, TN</span>
    </td>
</tr>
</table>
</body>
</html>


What I would say is that the padding amounts are very small.
Try it with bigger values and see if it really isn't working.

Foamcow Heavy Industries - Web design and ranting
Target Marketing Communications - Advertising, Direct Marketing and Public Relations
I wonder what possesses people to make those animated gifs. Do you just get up in the morning and think, "You know what web design r
 
thanks for the reply. i did something similar to what you suggested after i posted.

I discovered that the style is being applied to the the table cells. however, Now i figured out that the table is not inheritting the body font size.

I have a style that is being applied to the body.
Code:
BODY
{
    margin: 0px;
    font-size: 90%;
}

the table is contained in the body. what could be causing the table no to inherit the body font size?

-Jer
 
Internet Explorer. Sometimes browsers don't want to inherit font properties from body when it comes to tables. Just apply it to table as well.
 
well i figured it out.
DOCTYPE was incorrect.

ASP .NET's default doctype was incorrect.

/sigh

Code:
   ^
__/ \__
',   ,'
  .*.
 `   `

-Jer
 
Don't overlook what Vragabond said.

IE doesn't inherit font styles for tables.

The only problem with adding the style to the table is that i am using percentages for the font-size. i don't know if that is bad practice, but i hate specifying exact sizes. And i am using less than 100% for the body font-size because there are a few large datagrids (tables) on the page.

thanks for the help though.

-Jer
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top