Wednesday, March 28, 2012

Tables and column sizes

What do I have to do to get a column in a table to stay the same size no
matter what is in the other tables?
I've tried setting the width in px, in percentages, and nothing seems to
work; for example, the columns that are colored #cccccc I want to stay the
size of the menu control, which doesn't change.
However, if the column to the right of it, with the ucGeneral and ucDetails
controls, has nothing in it, or something very small, the #cccccc column
spreads out and I don't want it to do that. What's the secret.
<table runat=server bgcolor=white border=0 bordercolor=black height="100%"
width="100%" cellspacing=0 cellpadding=0 ID="Table1">
<tr height="10%" width="100%">
<td colspan=5><uc1:ucHeader id=UcHeader1
runat="server"></uc1:ucHeader></td>
</tr>
<tr valign=top>
<td bgcolor="#cccccc" rowspan=3 style="WIDTH: 10px"> </td>
<td bgcolor="#cccccc" rowspan=3 style="WIDTH: 10px"><uc1:ucMenu
id=UcMenu1 runat="server"></uc1:ucMenu></td>
<td bgcolor="#cccccc" rowspan=3 style="WIDTH: 10px"> </td>
<td bgcolor="white" rowspan=3> </td>
</tr>
<tr valign=top width="100%"><td valign=top><uc1:ucGeneral id=UcGeneral1
runat="server"></uc1:ucPointOfDiversionGeneral></td></tr>
<tr valign=top height="100%" width="100%"><td valign=top><uc1:ucDetails
id=UcDetails1 runat="server"></uc1:ucDetails></td>
</tr>
</table>
Thanks.In the column you want to be fixed, add the "nowrap" option in the TD tag.
For the column to the right, set it's width to 100%.
You could also try putting the contents of the fixed cell in a table of it's
own with a fixed size and aligned either center, left, or right. If the
right
column changes, it won't change how the nested table looks to the user.
2005 Microsoft MVP C#
Robbe Morris
http://www.robbemorris.com
http://www.mastervb.net/home/ng/for...st10017013.aspx
http://www.eggheadcafe.com/articles...e_generator.asp
"Iams" <Iams@.hotmail> wrote in message
news:%23iY$CvuEFHA.2180@.TK2MSFTNGP12.phx.gbl...
> What do I have to do to get a column in a table to stay the same size no
> matter what is in the other tables?
> I've tried setting the width in px, in percentages, and nothing seems to
> work; for example, the columns that are colored #cccccc I want to stay the
> size of the menu control, which doesn't change.
> However, if the column to the right of it, with the ucGeneral and
> ucDetails
> controls, has nothing in it, or something very small, the #cccccc column
> spreads out and I don't want it to do that. What's the secret.
> <table runat=server bgcolor=white border=0 bordercolor=black height="100%"
> width="100%" cellspacing=0 cellpadding=0 ID="Table1">
> <tr height="10%" width="100%">
> <td colspan=5><uc1:ucHeader id=UcHeader1
> runat="server"></uc1:ucHeader></td>
> </tr>
> <tr valign=top>
> <td bgcolor="#cccccc" rowspan=3 style="WIDTH: 10px"> </td>
> <td bgcolor="#cccccc" rowspan=3 style="WIDTH: 10px"><uc1:ucMenu
> id=UcMenu1 runat="server"></uc1:ucMenu></td>
> <td bgcolor="#cccccc" rowspan=3 style="WIDTH: 10px"> </td>
> <td bgcolor="white" rowspan=3> </td>
> </tr>
> <tr valign=top width="100%"><td valign=top><uc1:ucGeneral id=UcGeneral1
> runat="server"></uc1:ucPointOfDiversionGeneral></td></tr>
> <tr valign=top height="100%" width="100%"><td valign=top><uc1:ucDetails
> id=UcDetails1 runat="server"></uc1:ucDetails></td>
> </tr>
> </table>
>
> Thanks.
>
For the table set css rule table_layout:fixed; then specify the width for
the columns in the first row.
Eliyahu
"Iams" <Iams@.hotmail> wrote in message
news:%23iY$CvuEFHA.2180@.TK2MSFTNGP12.phx.gbl...
> What do I have to do to get a column in a table to stay the same size no
> matter what is in the other tables?
> I've tried setting the width in px, in percentages, and nothing seems to
> work; for example, the columns that are colored #cccccc I want to stay the
> size of the menu control, which doesn't change.
> However, if the column to the right of it, with the ucGeneral and
ucDetails
> controls, has nothing in it, or something very small, the #cccccc column
> spreads out and I don't want it to do that. What's the secret.
> <table runat=server bgcolor=white border=0 bordercolor=black height="100%"
> width="100%" cellspacing=0 cellpadding=0 ID="Table1">
> <tr height="10%" width="100%">
> <td colspan=5><uc1:ucHeader id=UcHeader1
> runat="server"></uc1:ucHeader></td>
> </tr>
> <tr valign=top>
> <td bgcolor="#cccccc" rowspan=3 style="WIDTH: 10px"> </td>
> <td bgcolor="#cccccc" rowspan=3 style="WIDTH: 10px"><uc1:ucMenu
> id=UcMenu1 runat="server"></uc1:ucMenu></td>
> <td bgcolor="#cccccc" rowspan=3 style="WIDTH: 10px"> </td>
> <td bgcolor="white" rowspan=3> </td>
> </tr>
> <tr valign=top width="100%"><td valign=top><uc1:ucGeneral id=UcGeneral1
> runat="server"></uc1:ucPointOfDiversionGeneral></td></tr>
> <tr valign=top height="100%" width="100%"><td valign=top><uc1:ucDetails
> id=UcDetails1 runat="server"></uc1:ucDetails></td>
> </tr>
> </table>
>
> Thanks.
>
Great ideas! Thanks so much!
"Robbe Morris [C# MVP]" <info@.turnkeytools.com> wrote in message
news:%23x78IcwEFHA.1924@.TK2MSFTNGP14.phx.gbl...
> In the column you want to be fixed, add the "nowrap" option in the TD tag.
> For the column to the right, set it's width to 100%.
> You could also try putting the contents of the fixed cell in a table of
it's
> own with a fixed size and aligned either center, left, or right. If the
> right
> column changes, it won't change how the nested table looks to the user.
> --
> 2005 Microsoft MVP C#
> Robbe Morris
> http://www.robbemorris.com
> http://www.mastervb.net/home/ng/for...st10017013.aspx
> http://www.eggheadcafe.com/articles...e_generator.asp
>
> "Iams" <Iams@.hotmail> wrote in message
> news:%23iY$CvuEFHA.2180@.TK2MSFTNGP12.phx.gbl...
the
height="100%"
id=UcGeneral1
valign=top><uc1:ucDetails
>

0 comments:

Post a Comment