HOME

ASP.NET Tutorial
ASP.NET HOME
ASP.NET Intro
ASP.NET vs ASP
ASP.NET Install
ASP.NET Pages
ASP.NET Controls
ASP.NET Events

References
HTML Controls
Web Controls
Validation Controls
Download XMLSpy here
Please visit our sponsors !

HtmlTableCell Control

Back

Definition and Usage

The HtmlTableCell control is used to control <td> and <th> elements. In HTML, these elements are used to create table cells and header table cells.


Properties

Property Description
Align The horizontal alignment of cell content
BGColor The background color of the cell
BorderColor The color of the borders
ColSpan The number of columns this cell should span
Height The height of the cell
id A unique id for the control
Nowrap Whether the text within this cell should be allowed to wrap
RowSpan The number of rows this cell should span
runat Specifies that the control is a server control.  Must be set to "server"
VAlign The vertical alignment of cell content
Width The width of the cell

Example 1

In the following example we declare an HtmlTable control and an HtmlInputButton control in an .aspx file (remember to embed the controls inside an HtmlForm control). When the submit button is triggered, the submit subroutine is executed. The submit subroutine modifies the background color and the border color of the table, it also changes the contents of the cells:

<script runat="server">
  Sub submit(sender As Object, e As EventArgs) 
    dim i,j
    t1.BGColor="yellow"
    t1.BorderColor="red"
    for i=0 To t1.Rows.Count-1
      for j=0 To t1.Rows(i).Cells.Count-1
        t1.Rows(i).Cells(j).InnerHtml="Row " & i 
      next
    next
  End Sub
</script>
<html>
<body>
<form runat="server">
<table id="t1" border="1" runat="server">
  <tr>
    <td>Cell 1</td>
    <td>Cell 2</td>
  </tr>
  <tr>
    <td>Cell 3</td>
    <td>Cell 4</td>
  </tr>
</table>
<br />
<input type="button" value="Change Contents"
OnServerClick="submit" runat="server"/>
</form>
</body>
</html>


Back

Jump to: Top of Page or HOME or Printer Friendly Printer friendly page


Search W3Schools:


What Others Say About Us

Does the world know about us? Check out these places:

Dogpile Alta Vista MSN Google Excite Lycos Yahoo Ask Jeeves


We Help You For Free. You Can Help Us!


W3Schools is for training only. We do not warrant its correctness or its fitness for use. The risk of using it remains entirely with the user. While using this site, you agree to have read and accepted our terms of use and privacy policy.

Copyright 1999-2002 by Refsnes Data. All Rights Reserved


Validate How we converted to XHTML Validate

IISCart
ASP Ecommerce & Shopping Cart


Your own Web Site?

Read W3Schools
Hosting Tutorial



$15 Domain Name
Registration
Save $20 / year!



Advertise
at W3Schools

Only 0.5 CPM



SELECTED LINKS

University Online
Master Degree
Bachelor Degree


Web Software

The Future of
Web Development


Jobs and Careers

Web Security
Web Statistics
Web Standards


PARTNERS

W3Schools
TopXML
VisualBuilder
XMLPitstop
DevelopersDex
DevGuru
Programmers Heaven
The Code Project
Tek Tips Forum
ZVON.ORG
TopXML Search