473,411 Members | 2,148 Online
Bytes | Software Development & Data Engineering Community
Post Job

Home Posts Topics Members FAQ

Join Bytes to post your question to a community of 473,411 software developers and data experts.

Problem with cell width (100%)

I am having a problem with a cell in a table in ASP.NET which used to work OK
in classic ASP. I have one cell in a row where the width should be 22 pixels
and the other cell should take up the remainder of the width available. In
ASP.NET the 2nd cell (when set to 100%) is 500 pixels wide (hence overlapping
the image in row 1), wheras in classic ASP the cell would have a width of
500-22 = 478 pixels (thus filling the remainder of the available space).

How do I do this in ASP.NET (I've tried setting the width to * but it
doesn't take up the remainder of the space)?

Classic ASP:

<table cellpadding="0" cellspacing="0"
style="background-color:#F2F2F2;width: 500px">
<tr><td colspan="2"><img src="/Images/top.gif" width=500 height=4></td></tr>
<tr>
<td width=22><img src="/Images/top.gif" width=22 height=22></td>
<td width:100%>The Cell</td>
</tr>
</table>

ASP.NET:

<table cellpadding="0" cellspacing="0"
style="background-color:#F2F2F2;width: 500px">
<tr><td colspan="2"><asp:Image ID="Image1" runat="server"
ImageUrl="~/Images/top.gif" /></td></tr>
<tr>
<td><asp:Image ID="Image4" runat="server" ImageUrl="~/Images/starbucks.gif"
/></td>
<td style="width:100%">The Cell</td>
</tr>
</table>
Jan 27 '06 #1
4 2756
Hiwj,

It looks like in your example for asp.net you have not set the first cell's
width to 22. After doing that you shouldn't even need to specify the second
cell's width because it should automatically take up the rest of the 500px
that the table is set to.

--
Sincerely,

S. Justin Gengo, MCP
Web Developer / Programmer

www.aboutfortunate.com

"Out of chaos comes order."
Nietzsche
"Hiwj" <Hi**@discussions.microsoft.com> wrote in message
news:28**********************************@microsof t.com...
I am having a problem with a cell in a table in ASP.NET which used to work
OK
in classic ASP. I have one cell in a row where the width should be 22
pixels
and the other cell should take up the remainder of the width available. In
ASP.NET the 2nd cell (when set to 100%) is 500 pixels wide (hence
overlapping
the image in row 1), wheras in classic ASP the cell would have a width of
500-22 = 478 pixels (thus filling the remainder of the available space).

How do I do this in ASP.NET (I've tried setting the width to * but it
doesn't take up the remainder of the space)?

Classic ASP:

<table cellpadding="0" cellspacing="0"
style="background-color:#F2F2F2;width: 500px">
<tr><td colspan="2"><img src="/Images/top.gif" width=500
height=4></td></tr>
<tr>
<td width=22><img src="/Images/top.gif" width=22 height=22></td>
<td width:100%>The Cell</td>
</tr>
</table>

ASP.NET:

<table cellpadding="0" cellspacing="0"
style="background-color:#F2F2F2;width: 500px">
<tr><td colspan="2"><asp:Image ID="Image1" runat="server"
ImageUrl="~/Images/top.gif" /></td></tr>
<tr>
<td><asp:Image ID="Image4" runat="server"
ImageUrl="~/Images/starbucks.gif"
/></td>
<td style="width:100%">The Cell</td>
</tr>
</table>

Jan 27 '06 #2
Justin

I have tried setting the width of the 1st column to 22px, but it doesn't
work (possibly due to the first row having a single cell with a colspan=2). I
have tried it with just one row and it works as you say.

I've tried setting the cell in the 1st row to width:500px, the 1st cell in
the 2nd row to 22px and leaving the 2nd cell in the 2nd row with no width (to
'fill' the remainder of the width), but it just doesn't seem to work.

Why does the colspan=2 affect the 2nd row?

Huw

"S. Justin Gengo [MCP]" wrote:
Hiwj,

It looks like in your example for asp.net you have not set the first cell's
width to 22. After doing that you shouldn't even need to specify the second
cell's width because it should automatically take up the rest of the 500px
that the table is set to.

--
Sincerely,

S. Justin Gengo, MCP
Web Developer / Programmer

www.aboutfortunate.com

"Out of chaos comes order."
Nietzsche
"Hiwj" <Hi**@discussions.microsoft.com> wrote in message
news:28**********************************@microsof t.com...
I am having a problem with a cell in a table in ASP.NET which used to work
OK
in classic ASP. I have one cell in a row where the width should be 22
pixels
and the other cell should take up the remainder of the width available. In
ASP.NET the 2nd cell (when set to 100%) is 500 pixels wide (hence
overlapping
the image in row 1), wheras in classic ASP the cell would have a width of
500-22 = 478 pixels (thus filling the remainder of the available space).

How do I do this in ASP.NET (I've tried setting the width to * but it
doesn't take up the remainder of the space)?

Classic ASP:

<table cellpadding="0" cellspacing="0"
style="background-color:#F2F2F2;width: 500px">
<tr><td colspan="2"><img src="/Images/top.gif" width=500
height=4></td></tr>
<tr>
<td width=22><img src="/Images/top.gif" width=22 height=22></td>
<td width:100%>The Cell</td>
</tr>
</table>

ASP.NET:

<table cellpadding="0" cellspacing="0"
style="background-color:#F2F2F2;width: 500px">
<tr><td colspan="2"><asp:Image ID="Image1" runat="server"
ImageUrl="~/Images/top.gif" /></td></tr>
<tr>
<td><asp:Image ID="Image4" runat="server"
ImageUrl="~/Images/starbucks.gif"
/></td>
<td style="width:100%">The Cell</td>
</tr>
</table>


Jan 27 '06 #3
Hiwj,

The other difference is that in your original example the image is
specifically set to 500px wide. That will automatically increase the size of
the top cell.

--
Sincerely,

S. Justin Gengo, MCP
Web Developer / Programmer

www.aboutfortunate.com

"Out of chaos comes order."
Nietzsche
"Hiwj" <Hi**@discussions.microsoft.com> wrote in message
news:96**********************************@microsof t.com...
Justin

I have tried setting the width of the 1st column to 22px, but it doesn't
work (possibly due to the first row having a single cell with a
colspan=2). I
have tried it with just one row and it works as you say.

I've tried setting the cell in the 1st row to width:500px, the 1st cell in
the 2nd row to 22px and leaving the 2nd cell in the 2nd row with no width
(to
'fill' the remainder of the width), but it just doesn't seem to work.

Why does the colspan=2 affect the 2nd row?

Huw

"S. Justin Gengo [MCP]" wrote:
Hiwj,

It looks like in your example for asp.net you have not set the first
cell's
width to 22. After doing that you shouldn't even need to specify the
second
cell's width because it should automatically take up the rest of the
500px
that the table is set to.

--
Sincerely,

S. Justin Gengo, MCP
Web Developer / Programmer

www.aboutfortunate.com

"Out of chaos comes order."
Nietzsche
"Hiwj" <Hi**@discussions.microsoft.com> wrote in message
news:28**********************************@microsof t.com...
>I am having a problem with a cell in a table in ASP.NET which used to
>work
>OK
> in classic ASP. I have one cell in a row where the width should be 22
> pixels
> and the other cell should take up the remainder of the width available.
> In
> ASP.NET the 2nd cell (when set to 100%) is 500 pixels wide (hence
> overlapping
> the image in row 1), wheras in classic ASP the cell would have a width
> of
> 500-22 = 478 pixels (thus filling the remainder of the available
> space).
>
> How do I do this in ASP.NET (I've tried setting the width to * but it
> doesn't take up the remainder of the space)?
>
> Classic ASP:
>
> <table cellpadding="0" cellspacing="0"
> style="background-color:#F2F2F2;width: 500px">
> <tr><td colspan="2"><img src="/Images/top.gif" width=500
> height=4></td></tr>
> <tr>
> <td width=22><img src="/Images/top.gif" width=22 height=22></td>
> <td width:100%>The Cell</td>
> </tr>
> </table>
>
> ASP.NET:
>
> <table cellpadding="0" cellspacing="0"
> style="background-color:#F2F2F2;width: 500px">
> <tr><td colspan="2"><asp:Image ID="Image1" runat="server"
> ImageUrl="~/Images/top.gif" /></td></tr>
> <tr>
> <td><asp:Image ID="Image4" runat="server"
> ImageUrl="~/Images/starbucks.gif"
> /></td>
> <td style="width:100%">The Cell</td>
> </tr>
> </table>


Jan 28 '06 #4
I seem to have found a solution that works:

Add style="table-layout:fixed" to the TABLE tag and use

<col width="26px" />
<col width="*" />

before the TR tag.

There must be a few more tags and styles which I was not aware of that
affected table layout in .NET. Anyway, thanks for the help.

Huw
"S. Justin Gengo [MCP]" wrote:
Hiwj,

The other difference is that in your original example the image is
specifically set to 500px wide. That will automatically increase the size of
the top cell.

--
Sincerely,

S. Justin Gengo, MCP
Web Developer / Programmer

www.aboutfortunate.com

"Out of chaos comes order."
Nietzsche
"Hiwj" <Hi**@discussions.microsoft.com> wrote in message
news:96**********************************@microsof t.com...
Justin

I have tried setting the width of the 1st column to 22px, but it doesn't
work (possibly due to the first row having a single cell with a
colspan=2). I
have tried it with just one row and it works as you say.

I've tried setting the cell in the 1st row to width:500px, the 1st cell in
the 2nd row to 22px and leaving the 2nd cell in the 2nd row with no width
(to
'fill' the remainder of the width), but it just doesn't seem to work.

Why does the colspan=2 affect the 2nd row?

Huw

"S. Justin Gengo [MCP]" wrote:
Hiwj,

It looks like in your example for asp.net you have not set the first
cell's
width to 22. After doing that you shouldn't even need to specify the
second
cell's width because it should automatically take up the rest of the
500px
that the table is set to.

--
Sincerely,

S. Justin Gengo, MCP
Web Developer / Programmer

www.aboutfortunate.com

"Out of chaos comes order."
Nietzsche
"Hiwj" <Hi**@discussions.microsoft.com> wrote in message
news:28**********************************@microsof t.com...
>I am having a problem with a cell in a table in ASP.NET which used to
>work
>OK
> in classic ASP. I have one cell in a row where the width should be 22
> pixels
> and the other cell should take up the remainder of the width available.
> In
> ASP.NET the 2nd cell (when set to 100%) is 500 pixels wide (hence
> overlapping
> the image in row 1), wheras in classic ASP the cell would have a width
> of
> 500-22 = 478 pixels (thus filling the remainder of the available
> space).
>
> How do I do this in ASP.NET (I've tried setting the width to * but it
> doesn't take up the remainder of the space)?
>
> Classic ASP:
>
> <table cellpadding="0" cellspacing="0"
> style="background-color:#F2F2F2;width: 500px">
> <tr><td colspan="2"><img src="/Images/top.gif" width=500
> height=4></td></tr>
> <tr>
> <td width=22><img src="/Images/top.gif" width=22 height=22></td>
> <td width:100%>The Cell</td>
> </tr>
> </table>
>
> ASP.NET:
>
> <table cellpadding="0" cellspacing="0"
> style="background-color:#F2F2F2;width: 500px">
> <tr><td colspan="2"><asp:Image ID="Image1" runat="server"
> ImageUrl="~/Images/top.gif" /></td></tr>
> <tr>
> <td><asp:Image ID="Image4" runat="server"
> ImageUrl="~/Images/starbucks.gif"
> /></td>
> <td style="width:100%">The Cell</td>
> </tr>
> </table>


Jan 28 '06 #5

This thread has been closed and replies have been disabled. Please start a new discussion.

Similar topics

0
by: Tom Pearson | last post by:
I create controls and validators dynamically dependent on data at runtime. I create the control then the relevant validator(s) for it assigning the Control.ID as the control to validate. These...
0
by: Job Lot | last post by:
I have an Expense Data Entry form which contains a DataGrid showing various expense categories. There are three columns Description, Cash Exp, Credit Exp, where Description column is readonly. ...
2
by: Andy Flash | last post by:
Hi. I'd like a little help working out what is going on with what should be a simple alignment problem. I have an outer table with a <td> which has an inner table. The <td> specified as...
0
by: Thomas Scheiderich | last post by:
I have a table that has 3 image slices. The middle slice changes size based on size of browser window. This works great. My client wants the date to show over the image on the right. So what I...
8
by: chrisoftoday | last post by:
Hi, I'm having trouble with some white space that's appearing in my table. I can't seem to spot the problem, it'd be great if someone could help. The HTML code (ignore the PHP, it shouldn't be...
2
by: Ch Pravin | last post by:
Hi All: I am having the following xml which i need to convert to excel using xslt. Please help me out. Afghanistan.xml <?xml version="1.0" encoding="utf-16"?> <Languages...
2
by: =?Utf-8?B?Y3JlYXZlczA2MjI=?= | last post by:
I have a nested datagrid in a xaml file, the parent datagrid loads the vendor information and the details loads the documents for that vendor in a datagrid. Everything is working fine until I click...
2
by: swethak | last post by:
hi , i write the code in .htm file. It is in cgi-bin/searches/one.htm.In that i write a form submitting and validations.But validations are not worked in that .htm file. I used the same code in my...
2
by: slapsh0t11 | last post by:
So, I've been working on this Game of Life (http://www.bitstorm.org/gameoflife/) project, and all the code has been written. However, it will not run. First, I will post the error message and the...
0
BarryA
by: BarryA | last post by:
What are the essential steps and strategies outlined in the Data Structures and Algorithms (DSA) roadmap for aspiring data scientists? How can individuals effectively utilize this roadmap to progress...
1
by: nemocccc | last post by:
hello, everyone, I want to develop a software for my android phone for daily needs, any suggestions?
0
by: Hystou | last post by:
There are some requirements for setting up RAID: 1. The motherboard and BIOS support RAID configuration. 2. The motherboard has 2 or more available SATA protocol SSD/HDD slots (including MSATA, M.2...
0
marktang
by: marktang | last post by:
ONU (Optical Network Unit) is one of the key components for providing high-speed Internet services. Its primary function is to act as an endpoint device located at the user's premises. However,...
0
Oralloy
by: Oralloy | last post by:
Hello folks, I am unable to find appropriate documentation on the type promotion of bit-fields when using the generalised comparison operator "<=>". The problem is that using the GNU compilers,...
0
jinu1996
by: jinu1996 | last post by:
In today's digital age, having a compelling online presence is paramount for businesses aiming to thrive in a competitive landscape. At the heart of this digital strategy lies an intricately woven...
0
tracyyun
by: tracyyun | last post by:
Dear forum friends, With the development of smart home technology, a variety of wireless communication protocols have appeared on the market, such as Zigbee, Z-Wave, Wi-Fi, Bluetooth, etc. Each...
0
agi2029
by: agi2029 | last post by:
Let's talk about the concept of autonomous AI software engineers and no-code agents. These AIs are designed to manage the entire lifecycle of a software development project—planning, coding, testing,...
0
isladogs
by: isladogs | last post by:
The next Access Europe User Group meeting will be on Wednesday 1 May 2024 starting at 18:00 UK time (6PM UTC+1) and finishing by 19:30 (7.30PM). In this session, we are pleased to welcome a new...

By using Bytes.com and it's services, you agree to our Privacy Policy and Terms of Use.

To disable or enable advertisements and analytics tracking please visit the manage ads & tracking page.