473,883 Members | 1,624 Online
Bytes | Software Development & Data Engineering Community
+ Post

Home Posts Topics Members FAQ

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="Tes t.aspx.cs" AutoEventWireup ="false"
Inherits="TestW ebApp.WebForm1" debug="True"%>
<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.0 Transitional//EN" >
<HTML>
<HEAD>
<title>WebForm1 </title>
<meta name="GENERATOR " Content="Micros oft Visual Studio .NET 7.1">
<meta name="CODE_LANG UAGE" Content="C#">
<meta name="vs_defaul tClientScript" content="JavaSc ript">
<meta name="vs_target Schema"
content="http://schemas.microso ft.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 6244
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*@discussion s.microsoft.com wrote in message
news:E2******** *************** ***********@mic rosoft.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="Tes t.aspx.cs" AutoEventWireup ="false"
Inherits="TestW ebApp.WebForm1" debug="True"%>
<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.0 Transitional//EN" >
<HTML>
<HEAD>
<title>WebForm1 </title>
<meta name="GENERATOR " Content="Micros oft Visual Studio .NET 7.1">
<meta name="CODE_LANG UAGE" Content="C#">
<meta name="vs_defaul tClientScript" content="JavaSc ript">
<meta name="vs_target Schema"
content="http://schemas.microso ft.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 thread has been closed and replies have been disabled. Please start a new discussion.

Similar topics

1
8462
by: Kai Grossjohann | last post by:
I have a table which contains a top-aligned table cell: .... <tr style="height:40"> ... <td colspan="1" rowspan="2" align="left" valign="top" style="overflow:hidden;"> ...contents.explained.later... </td> ...
23
18731
by: MattB | last post by:
Hello please help, I have a table cell with a div in it. The div has a width of 300px. but when it is rendered it puts extra space into the table cell. Here's the style <style> #treecontainer {
3
10898
by: Thomas Mlynarczyk | last post by:
Hello, How can I make an <a> element (containing text only, styled to be a box with a border) as big as the table cell in which it resides, *without* having specified any width/height (neither fixed nor percentage) for this table cell? Sizing the element to 100% width and height does not work, as the parent element's width and height are not specified. And yet, in this case at least, the width and height of the table cell are very...
2
11272
by: Sugapablo | last post by:
Can anyone help me out with some code to change three table cells (<td>) when one is hovered over? I have a calendar grid where each day is made up of three table cells and I want all three to change color when any of the three are hovered over. I would prefer to do this with pure CSS if possible, but if Javascript is the only way...so be it. --
2
11610
by: ted | last post by:
Hi, Was wondering if it's possible to find the left position of a table cell if the cell is created dynamically. I have a table with a single cell. When a button is clicked, I'd like to add another cell to it, give the cell a class style and then find the cell's left position. Right now I'm using doing this:
5
3904
by: Greg N. | last post by:
Hi folks, I have a table cell with a background image, something like <td background=landscape.jpg height=200></td> The sole purpose of this code is to display the image inside that table cell. It displays just as much of the image as the current cell width allows. The actual cell width is determined by other cells in the same table column and by the current browser window width.
1
3556
by: Thanks | last post by:
I have a routine that is called on Page_Init. It retrieves folder records from a database which I display as Link Buttons in a table cell. I set the table cell's bgcolor to a default color (say black for example). I am dynamically creating the LinkButton controls and adding them into the table cell and I've also hooked up an event handler for each LinkButton's Click event. This all works fine. Now in the Link Button's Click event...
2
65017
by: Yeah | last post by:
Hi, all! I have a question. I am designing a listing similar to a phone book in HTML. Each listing has periods following it, but they must extend to the end of the table cell, and not wrap. Is there any way to prevent the text from 1) wrapping within the table cell and 2) causing the table cell to expand? In other words, the filler periods must flow past the right boundary of the cell (but not be seen). Similar to:
1
16675
by: Bart Lateur | last post by:
I'm trying to put a utton at the bottom (right) of a TD cell, irrespective of what else is in there. Usually, with other HTML block elements, we're told to use position: relative on the parent element, and position: absolute; bottom: 0px;
0
9943
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, people are often confused as to whether an ONU can Work As a Router. In this blog post, well explore What is ONU, What Is Router, ONU & Routers main usage, and What is the difference between ONU and Router. Lets take a closer look ! Part I. Meaning of...
0
10750
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 tapestry of website design and digital marketing. It's not merely about having a website; it's about crafting an immersive digital experience that captivates audiences and drives business growth. The Art of Business Website Design Your website is...
1
10858
by: Hystou | last post by:
Overview: Windows 11 and 10 have less user interface control over operating system update behaviour than previous versions of Windows. In Windows 11 and 10, there is no way to turn off the Windows Update option using the Control Panel or Settings app; it automatically checks for updates and installs any it finds, whether you like it or not. For most users, this new feature is actually very convenient. If you want to control the update process,...
0
10419
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 protocol has its own unique characteristics and advantages, but as a user who is planning to build a smart home system, I am a bit confused by the choice of these technologies. I'm particularly interested in Zigbee because I've heard it does some...
0
9577
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 projectplanning, coding, testing, and deploymentwithout human intervention. Imagine an AI that can take a project description, break it down, write the code, debug it, and then launch it, all on its own.... Now, this would greatly impact the work of software developers. The idea...
1
7974
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 presenter, Adolph Dupr who will be discussing some powerful techniques for using class modules. He will explain when you may want to use classes instead of User Defined Types (UDT). For example, to manage the data in unbound forms. Adolph will...
0
5804
by: TSSRALBI | last post by:
Hello I'm a network technician in training and I need your help. I am currently learning how to create and manage the different types of VPNs and I have a question about LAN-to-LAN VPNs. The last exercise I practiced was to create a LAN-to-LAN VPN between two Pfsense firewalls, by using IPSEC protocols. I succeeded, with both firewalls in the same network. But I'm wondering if it's possible to do the same thing, with 2 Pfsense firewalls...
1
4619
by: 6302768590 | last post by:
Hai team i want code for transfer the data from one system to another through IP address by using C# our system has to for every 5mins then we have to update the data what the data is updated we have to send another system
3
3237
bsmnconsultancy
by: bsmnconsultancy | last post by:
In today's digital era, a well-designed website is crucial for businesses looking to succeed. Whether you're a small business owner or a large corporation in Toronto, having a strong online presence can significantly impact your brand's success. BSMN Consultancy, a leader in Website Development in Toronto offers valuable insights into creating effective websites that not only look great but also perform exceptionally well. In this comprehensive...

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.