gridview not 100% width on page

P

psion

Hi,
We have a gridview on a webpage, which we would like to be 100% of the
table cell in which it is placed.
When we specify the width to be 100%, this has no effect, but only if
we specify a pixel number, i.e. 800, will the gridview be 800 px wide.

Here is an example:
http://www.valuetronics.com/Results.aspx?keywords=8050&x=0&y=0

And this may be related, but this page
http://www.valuetronics.com/Distributor_Products.aspx?mfgr=33
displays the grid at 100%, while
http://www.valuetronics.com/Distributor_Products.aspx?mfgr=3111
does not, in either firefox or ie.

btw, using 1024 resolution will seem like the grid is 100% width, but
when switched to 1280, that's when I can see it.

Has anyone experienced this?

Thank you,
Krzysztof
 
B

bruce barker

with css there are two conflicting issues with sizing.

the default size of a parent object is the size of its contained children
plus margin and padding. when you make a child 100% of its parent, one of the
parents in the chain must have an absolute size, or the 100% is meanless (a
100% of what?) if no widths are set in the chain, the width becomes the width
of the body. tables are nore strict than divs in this area as the td's are
the size of the children

unlike width, body, has no default height, so for height 100% to work, you
need to specify an absolute height in the chain.

in your case, the table probably does not have a width, so the td does not
have a width:

<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN"
"http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<html xmlns="http://www.w3.org/1999/xhtml">
<body>
<div style="background:red;">
<div style="width:100%; background:green;">
in green div - width of body
</div>
<table>
<tr>
<td>
<div style="width:100%; background:yellow;">
in yellow td - width of text as td has no width
</div>
</td>
</tr>
</table>
</div>
</body>
</html>




-- bruce (sqlwork.com)
 

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

Top