Leer en inglés

Compartir a través de


UpdatePanelRenderMode Enumeración

Definición

Representa las posibles opciones de representación de la distribución del contenido de un control UpdatePanel de una página.

C#
public enum UpdatePanelRenderMode
Herencia
UpdatePanelRenderMode

Campos

Nombre Valor Description
Block 0

Especifica que el contenido del control UpdatePanel se representa dentro de un elemento <div> HTML.

Inline 1

Especifica que el contenido del control UpdatePanel se representa dentro de un elemento <span> HTML.

Ejemplos

En el ejemplo siguiente se muestra cómo establecer mediante declaración la UpdatePanel.RenderMode propiedad en Inline. El UpdatePanel control contiene una cadena que representa el número de postbacks de la página. El contenido se representa en línea con el texto circundante.

ASP.NET (C#)

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

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

<script runat="server">
    protected int PostBackCount
    {
        get
        {
            return (int)(ViewState["PostBackCount"] ?? 0);
        }
        set
        {
            ViewState["PostBackCount"] = value;
        }
    }
    protected void Page_Load(object sender, EventArgs e)
    {
        if (IsPostBack)
        {
            PostBackCount++;
        }
    }

</script>

<html xmlns="http://www.w3.org/1999/xhtml">
<head id="Head1" runat="server">
    <title>UpdatePanelRenderMode Example</title>
</head>
<body>
    <form id="form1" runat="server">
        <div>
            <asp:ScriptManager ID="ScriptManager1"
                               runat="server" />
            The number of times you have clicked the button is
            <asp:UpdatePanel ID="UpdatePanel1"
                             UpdateMode="Conditional"
                             RenderMode="Inline"
                             runat="server">
                <ContentTemplate>
                    <%= PostBackCount.ToString() %>
                    times. Every time you click the count is incremented. The panel
                    containing the number of times you clicked is rendered in-line.
                    <br />
                    <asp:Button ID="Button1"
                                Text="Increment"
                                runat="server" />
                </ContentTemplate>
            </asp:UpdatePanel>
        </div>
    </form>
</body>
</html>

Comentarios

La UpdatePanelRenderMode enumeración define qué elementos HTML se van a usar para incluir el contenido del UpdatePanel control. La UpdatePanel.RenderMode propiedad debe ser uno de los valores de la UpdatePanelRenderMode enumeración . El contenido de un UpdatePanel control se puede representar dentro de un elemento HTML <div> o un <span> elemento .

El valor de propiedad predeterminado RenderMode es Block.

Se aplica a

Producto Versiones
.NET Framework 3.5, 4.0, 4.5, 4.5.1, 4.5.2, 4.6, 4.6.1, 4.6.2, 4.7, 4.7.1, 4.7.2, 4.8, 4.8.1

Consulte también