HtmlTableCell.RowSpan Propriedade

Definição

Obtém ou define o número de linhas ocupadas por uma célula representada por uma instância da classe HtmlTableCell.Gets or sets the number of rows occupied by a cell represented by an instance of the HtmlTableCell class.

public:
 property int RowSpan { int get(); void set(int value); };
public int RowSpan { get; set; }
member this.RowSpan : int with get, set
Public Property RowSpan As Integer

Valor da propriedade

Int32

O número de linhas ocupadas por uma célula representada por uma instância da classe HtmlTableCell.The number of rows occupied by a cell represented by an instance of the HtmlTableCell class. O valor padrão é -1, que indica que essa propriedade não está definida.The default value is -1, which indicates that this property is not set.

Exemplos

O exemplo de código a seguir demonstra como usar a RowSpan propriedade para especificar que a célula na primeira coluna do HtmlTable controle abrange duas linhas.The following code example demonstrates how to use the RowSpan property to specify that the cell in the first column of the HtmlTable control spans two rows.

<%@ Page Language="C#" AutoEventWireup="True" %>

<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN"
    "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<html xmlns="http://www.w3.org/1999/xhtml" >
<head>
   <title>HtmlTableCell Example</title>
</head>
<body>

   <form id="form1" runat="server">

      <h3>HtmlTableCell Example</h3>

          <table id="Table1" runat="server" 
                style="border-width: 1; border-color: Black">

         <tr>
            <td rowspan="2">
               Cell 1.
            </td>
            <td>
               Cell 2.
            </td>
         </tr>
         <tr>
            <td>
               Cell 4.
            </td>
         </tr>

      </table>      

   </form>

</body>
</html>
<%@ Page Language="VB" AutoEventWireup="True" %>

<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN"
    "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<html xmlns="http://www.w3.org/1999/xhtml" >
<head>
   <title>HtmlTableCell Example</title>
</head>
<body>

   <form id="form1" runat="server">

      <h3>HtmlTableCell Example</h3>

          <table id="Table1" runat="server" 
                style="border-width: 1; border-color: Black">

         <tr>
            <td rowspan="2">
               Cell 1.
            </td>
            <td>
               Cell 2.
            </td>
         </tr>
         <tr>
            <td>
               Cell 4.
            </td>
         </tr>

      </table>      

   </form>

</body>
</html>

Comentários

Em uma célula representada por uma instância da HtmlTableCell classe, use a RowSpan propriedade para especificar o número de linhas ocupadas pela célula.In a cell represented by an instance of the HtmlTableCell class, use the RowSpan property to specify the number of rows the cell occupies. Isso permite que você crie uma célula na tabela que ocupe mais de uma linha.This allows you to create a cell in the table that occupies more than one row. Por exemplo, suponha que você tenha uma tabela que contenha duas colunas e duas linhas.For example, suppose you have a table that contains two columns and two rows. Você pode criar uma coluna que sobrepõe ambas as linhas.You can create a column that overlaps both rows. Defina a RowSpan propriedade da célula mais à esquerda na primeira coluna como 2 para indicar que essa célula ocupa duas linhas na tabela.Set the RowSpan property of the leftmost cell in the first column to 2 to indicate that this cell takes up two rows in the table.

Cuidado

Ao abranger linhas, certifique-se de definir uma célula a menos na coluna para cada linha que você ocupar.When spanning rows, be sure to define one fewer cell in the column for each row that you span. Por exemplo, se você abranger duas linhas, defina uma célula a menos nessa coluna.For example, if you span two rows, define one fewer cell in that column. Caso contrário, essa coluna será maior do que o número de linhas na tabela e a tabela não será exibida conforme o esperado.Otherwise, that column will be longer than the number of rows in the table and the table will not be displayed as expected.

Aplica-se a

Confira também