468,765 Members | 1,745 Online
Bytes | Developer Community
New Post

Home Posts Topics Members FAQ

Post your question to a community of 468,765 developers. It's quick & easy.

How do you autosize a Table Cell?

SAL
How do I get a CELL to autosize a round a Control in a HTML Table?

For example, you add a 2 row, 3 column HTML table to your webpage. In the
1st row, you set the colspan=3, then delete the excess columns. Now the 1st
row should look like it has only 1 cell, and the 2nd row has 3 cells. Now
add a Web Forms DataGrid in row, and add a Web Forms Button in the middle
cell of row 2.

Now, when I try to resize the row, I can’t seem to get it to size to the
controls. There always seem to be a gap below or to the left.

Does anyone have any suggestions? I’m fairly new with ASP.net. Here is the
HTML code:

<%@ Page language="c#" Codebehind="Test.aspx.cs" AutoEventWireup="false"
Inherits="TestWebApp.WebForm1" debug="True"%>
<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.0 Transitional//EN" >
<HTML>
<HEAD>
<title>WebForm1</title>
<meta name="GENERATOR" Content="Microsoft Visual Studio .NET 7.1">
<meta name="CODE_LANGUAGE" Content="C#">
<meta name="vs_defaultClientScript" content="JavaScript">
<meta name="vs_targetSchema"
content="http://schemas.microsoft.com/intellisense/ie5">
</HEAD>
<body MS_POSITIONING="GridLayout">
<form id="Form1" method="post" runat="server">
<TABLE id="Table2" style="Z-INDEX: 102; LEFT: 20px; POSITION: absolute;
TOP: 16px" cellSpacing="1"
cellPadding="1" width="300" border="1">
<TR>
<TD colSpan="3" style="HEIGHT: 162px">
<asp:DataGrid id="DataGrid2" runat="server" Height="162px"
Width="301px"></asp:DataGrid></TD>
</TR>
<TR>
<TD style="WIDTH: 45px"></TD>
<TD style="WIDTH: 3px">
<asp:Button id="Button1" runat="server" Text="Button"></asp:Button></TD>
<TD></TD>
</TR>
</TABLE>
</form>
</body>
</HTML>

Aug 10 '06 #1
1 5329
Perhaps you need to be setting your tablecell's or your controls width
property based on percentages of total width.

http://msdn2.microsoft.com/en-us/lib...rol.width.aspx

Dont know if its the answer but it might help you find one.

--
Regards

John Timney (MVP)
"SAL" <SA*@discussions.microsoft.comwrote in message
news:E2**********************************@microsof t.com...
How do I get a CELL to autosize a round a Control in a HTML Table?

For example, you add a 2 row, 3 column HTML table to your webpage. In the
1st row, you set the colspan=3, then delete the excess columns. Now the
1st
row should look like it has only 1 cell, and the 2nd row has 3 cells. Now
add a Web Forms DataGrid in row, and add a Web Forms Button in the middle
cell of row 2.

Now, when I try to resize the row, I can't seem to get it to size to the
controls. There always seem to be a gap below or to the left.

Does anyone have any suggestions? I'm fairly new with ASP.net. Here is
the
HTML code:

<%@ Page language="c#" Codebehind="Test.aspx.cs" AutoEventWireup="false"
Inherits="TestWebApp.WebForm1" debug="True"%>
<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.0 Transitional//EN" >
<HTML>
<HEAD>
<title>WebForm1</title>
<meta name="GENERATOR" Content="Microsoft Visual Studio .NET 7.1">
<meta name="CODE_LANGUAGE" Content="C#">
<meta name="vs_defaultClientScript" content="JavaScript">
<meta name="vs_targetSchema"
content="http://schemas.microsoft.com/intellisense/ie5">
</HEAD>
<body MS_POSITIONING="GridLayout">
<form id="Form1" method="post" runat="server">
<TABLE id="Table2" style="Z-INDEX: 102; LEFT: 20px; POSITION: absolute;
TOP: 16px" cellSpacing="1"
cellPadding="1" width="300" border="1">
<TR>
<TD colSpan="3" style="HEIGHT: 162px">
<asp:DataGrid id="DataGrid2" runat="server" Height="162px"
Width="301px"></asp:DataGrid></TD>
</TR>
<TR>
<TD style="WIDTH: 45px"></TD>
<TD style="WIDTH: 3px">
<asp:Button id="Button1" runat="server" Text="Button"></asp:Button></TD>
<TD></TD>
</TR>
</TABLE>
</form>
</body>
</HTML>

Aug 10 '06 #2

This discussion thread is closed

Replies have been disabled for this discussion.

Similar topics

3 posts views Thread by Thomas Mlynarczyk | last post: by
2 posts views Thread by ted | last post: by
5 posts views Thread by Greg N. | last post: by
1 post views Thread by Thanks | last post: by
2 posts views Thread by Yeah | last post: by
1 post views Thread by Bart Lateur | last post: by
1 post views Thread by CARIGAR | last post: by
reply views Thread by Marin | last post: by
By using this site, you agree to our Privacy Policy and Terms of Use.