asp.net.ph

TableCell.RowSpan Property

System.Web.UI.WebControls Namespace   TableCell Class


Sets or retrieves the number of rows that the TableCell control spans.

Syntax


Inline <asp:tablecell rowspan = intRows ... >
Script TableCell.RowSpan [ = intRows ]

Property Value


intRows Integer specifying the number of rows the TableCell occupies.

The property is read/write with a default value of -1 ( not enabled ).

Remarks

Cells can be merged, or can span rows or columns.

Use the RowSpan property to specify how many rows in the Table the cell should span. This allows you to create a cell in the table that occupies more than one row.

When spanning rows, be sure to define one less cell in the column for each row that you span, as shown in the sample below. Otherwise, that column will have more than the number of rows in the table and the table will not be rendered as expected.

NOTE: Specifying a zero value for RowSpan means that the cell spans all rows from the current row to the last row of the table in which the cell is defined.

Example

The following shows how to declaratively set the RowSpan property of a TableCell at design time.

<asp:table width = "70%" runat = "server"
      horizontalalign = "center" gridlines = "both" cellpadding=10>
   <asp:tablerow>
      <asp:tableheadercell rowspan=3>
         This header<br> spans 3 rows
      </asp:tableheadercell>
      <asp:tablecell>Cell 1</asp:tablecell>
      <asp:tablecell>Cell 2</asp:tablecell>
   </asp:tablerow>
   <asp:tablerow>
      <asp:tablecell>Cell 3</asp:tablecell>
      <asp:tablecell>Cell 4</asp:tablecell>
   </asp:tablerow>
   <asp:tablerow>
      <asp:tablecell>Cell 5</asp:tablecell>
      <asp:tablecell>Cell 6</asp:tablecell>
   </asp:tablerow>
</asp:table>

Which would render as follows:

This header
spans 3 rows
Cell 1Cell 2
Cell 3Cell 4
Cell 5Cell 6

Notice that in the second and third rows, we only have two <asp:tablecell> elements each. This is because the <asp:tableheadercell> in the first row, with its RowSpan set to 3, already occupies, or spans, the first cells of each row.

See Also

TableCell Members   ColumnSpan Skip Navigation Links




Home
Suggested Reading


Previous page Back to top Next page

© 2000-2010 Rey Nuñez All rights reserved.

If you have any question, comment or suggestion
about this site, please send us a note

You can help support asp.net.ph