Compartir por


WebControl.Height Propiedad

Definición

Obtiene o establece el alto del control de 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 propiedad

Unit que representa el alto del control. El valor predeterminado es Empty.

Atributos

Excepciones

El alto se estableció en un valor negativo.

Ejemplos

En el ejemplo siguiente se muestra cómo establecer mediante declaración la Height propiedad del control, heredada de Table la WebControl clase 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>

Comentarios

Use la Height propiedad para especificar el alto del control de servidor web.

Nota:

Esta propiedad no se representa para todos los controles de exploradores anteriores a la versión 4 de Microsoft Internet Explorer. Los controles que no representan esta propiedad en exploradores anteriores incluyen Label, HyperLink, LinkButtony los controles de validación. RadioButtonList DataList Y CheckBoxListtampoco representan esta propiedad en exploradores anteriores cuando su RepeatLayout propiedad está establecida RepeatLayout.Flowen . Además, solo se admiten tipos de unidad de Pixel y Percentage en exploradores anteriores.

Dado que esta propiedad no es HTML estándar, los controles de servidor web que se muestran como una tabla, como Table y DataGrid, no admiten esta propiedad en exploradores anteriores a la versión 4 de Microsoft Internet Explorer.

Nota:

Para establecer la Height propiedad en un tipo de unidad distinto del valor predeterminado de , debe crear un nuevo tipo de unidad específico para el tipo de Pixelunidad que desee. Por ejemplo, para establecer la propiedad de Height un control en un valor porcentual de 100, puede hacer lo siguiente:

myWebControl.Width = Unit.Percentage(100);

Para obtener más información sobre los tipos de unidad disponibles para la Height propiedad , vea la Unit clase .

Se aplica a

Consulte también