Lire en anglais

Partager via


UpdatePanelRenderMode Énumération

Définition

Représente la disposition possible qui restitue des options pour le contenu d'un contrôle UpdatePanel sur une page.

C#
public enum UpdatePanelRenderMode
Héritage
UpdatePanelRenderMode

Champs

Nom Valeur Description
Block 0

Spécifie que le contenu du contrôle UpdatePanel est restitué à l'intérieur d'un élément <div> HTML.

Inline 1

Spécifie que le contenu du contrôle UpdatePanel est restitué à l'intérieur d'un élément <span> HTML.

Exemples

L’exemple suivant montre comment définir de manière déclarative la UpdatePanel.RenderMode propriété sur Inline. Le UpdatePanel contrôle contient une chaîne qui représente le nombre de publications postback de la page. Le contenu est affiché en ligne avec le texte environnant.

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>

Remarques

L’énumération UpdatePanelRenderMode définit les éléments HTML à utiliser pour inclure le contenu du UpdatePanel contrôle. La UpdatePanel.RenderMode propriété doit être l’une des valeurs de l’énumération UpdatePanelRenderMode . Le contenu d’un UpdatePanel contrôle peut être rendu à l’intérieur d’un élément HTML <div> ou d’un <span> élément.

La valeur par défaut RenderMode de la propriété est Block.

S’applique à

Produit Versions
.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

Voir aussi