WebControl.Height Propriedade

Definição

Obtém ou define a altura do controlo do servidor Web.

public:
 virtual property System::Web::UI::WebControls::Unit Height { System::Web::UI::WebControls::Unit get(); void set(System::Web::UI::WebControls::Unit value); };
[System.ComponentModel.Bindable(true)]
public virtual System.Web.UI.WebControls.Unit Height { get; set; }
public virtual System.Web.UI.WebControls.Unit Height { get; set; }
[<System.ComponentModel.Bindable(true)>]
member this.Height : System.Web.UI.WebControls.Unit with get, set
member this.Height : System.Web.UI.WebControls.Unit with get, set
Public Overridable Property Height As Unit

Valor de Propriedade

A Unit que representa a altura do controlo. A predefinição é Empty.

Atributos

Exceções

A altura foi definida para um valor negativo.

Exemplos

O exemplo seguinte ilustra como definir declarativamente a Height propriedade do Table controlo, herdada da WebControl classe base.

<%@ 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">

<script runat="server">
</script>

<html xmlns="http://www.w3.org/1999/xhtml" >
<head id="Head1" runat="server">
    <title>Table Property</title>
</head>
<body>
    <form id="form1" runat="server">
    <div>
        <h3>Property of a Table Web Control</h3>
 
        <asp:Table id="Table1" runat="server"
            CellPadding = "10" 
            CellSpacing="0"
            GridLines="Both"
            Height="300">

            <asp:TableRow>
                <asp:TableCell>
                    Row 0, Col 0
                </asp:TableCell>
                <asp:TableCell>
                    Row 0, Col 1
                </asp:TableCell>
            </asp:TableRow>

            <asp:TableRow>
                <asp:TableCell>
                    Row 1, Col 0
                </asp:TableCell>
                <asp:TableCell>
                    Row 1, Col 1
                </asp:TableCell>
            </asp:TableRow>
        </asp:Table>
    </div>
    </form>
</body>
</html>
<%@ Page Language="VB" %>

<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" 
    "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">

<script runat="server">
</script>

<html xmlns="http://www.w3.org/1999/xhtml" >
<head id="Head1" runat="server">
    <title>Table Property</title>
</head>
<body>
    <form id="form1" runat="server">
    <div>
        <h3>Property of a Table Web Control</h3>
 
        <asp:Table id="Table1" runat="server"
            CellPadding = "10" 
            CellSpacing="0"
            GridLines="Both"
            Height="300">

            <asp:TableRow>
                <asp:TableCell>
                    Row 0, Col 0
                </asp:TableCell>
                <asp:TableCell>
                    Row 0, Col 1
                </asp:TableCell>
            </asp:TableRow>

            <asp:TableRow>
                <asp:TableCell>
                    Row 1, Col 0
                </asp:TableCell>
                <asp:TableCell>
                    Row 1, Col 1
                </asp:TableCell>
            </asp:TableRow>
        </asp:Table>
    </div>
    </form>
</body>
</html>

Observações

Use a Height propriedade para especificar a altura do controlo do servidor Web.

Note

Esta propriedade não é renderizada para todos os controlos nos navegadores anteriores à versão 4 Microsoft Internet Explorer. Controlos que não renderizam esta propriedade em navegadores anteriores incluem Label, HyperLink, LinkButton, e quaisquer controlos de validação. Os , e também não renderizam esta propriedade em navegadores anteriores quando a sua CheckBoxList propriedade está definida para RadioButtonList.DataListRepeatLayoutRepeatLayout.Flow Além disso, apenas os tipos de unidades de Pixel e Percentage são suportados em navegadores mais antigos.

Como esta propriedade é HTML não padrão, os controlos de servidores web que exibem como tabela, como Table e DataGrid, não suportam esta propriedade em navegadores anteriores à Microsoft Internet Explorer versão 4.

Note

Para definir a Height propriedade para um tipo de unidade diferente do padrão de Pixel, deve criar um novo tipo de unidade específico para o tipo de unidade que pretende. Por exemplo, para definir a propriedade de Height um controlo com um valor percentual de 100, pode fazer o seguinte:

myWebControl.Width = Unit.Percentage(100);

Para mais informações sobre os tipos de unidades disponíveis para a Height propriedade, consulte a Unit classe.

Aplica-se a

Ver também