UpdatePanelRenderMode UpdatePanelRenderMode UpdatePanelRenderMode UpdatePanelRenderMode Enum

Definition

Stellt die möglichen Layout-Renderingoptionen für den Inhalt eines UpdatePanel-Steuerelements auf einer Seite dar.Represents the possible layout rendering options for the content of an UpdatePanel control on a page.

public enum class UpdatePanelRenderMode
public enum UpdatePanelRenderMode
type UpdatePanelRenderMode = 
Public Enum UpdatePanelRenderMode
Vererbung
UpdatePanelRenderModeUpdatePanelRenderModeUpdatePanelRenderModeUpdatePanelRenderMode

Felder

Block Block Block Block 0

Gibt an, dass der Inhalt des UpdatePanel-Steuerelements in einem <div>-HTML-Element gerendert wird.Specifies that the content of the UpdatePanel control is rendered inside an HTML <div> element.

Inline Inline Inline Inline 1

Gibt an, dass der Inhalt des UpdatePanel-Steuerelements in einem <span>-HTML-Element gerendert wird.Specifies that the content of the UpdatePanel control is rendered inside an HTML <span> element.

Beispiele

Im folgenden Beispiel wird gezeigt, wie die UpdatePanel.RenderMode -Eigenschaft deklarativ auf Inlinefestgelegt wird.The following example shows how to declaratively set the UpdatePanel.RenderMode property to Inline. Das UpdatePanel -Steuerelement enthält eine Zeichenfolge, die die Anzahl von Postbacks von der Seite darstellt.The UpdatePanel control contains a string that represents the number of postbacks from the page. Der Inhalt wird Inline mit dem umgebenden Text gerendert.The contents are rendered inline with the surrounding text.


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

<%@ 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">
    Protected Property PostBackCount As Integer
        Get
            If Not ViewState("PostBackCount") Is Nothing Then
                Return ViewState("PostBackCount")
            Else : Return 0
            End If
        End Get
        Set(ByVal value As Integer)
            ViewState("PostBackCount") = Value
        End Set
    End Property
    
    Protected Sub Page_Load(ByVal sender As Object, ByVal e As System.EventArgs)
        If IsPostBack Then
            PostBackCount += 1
        End If
    End Sub
</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"
                             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>

Hinweise

Die UpdatePanelRenderMode -Enumeration definiert, welche HTML-Elemente verwendet werden, um den Inhalt UpdatePanel des-Steuer Elements einzuschließen.The UpdatePanelRenderMode enumeration defines which HTML elements to use to enclose the content of the UpdatePanel control. Die UpdatePanel.RenderMode -Eigenschaft muss einer der Werte UpdatePanelRenderMode der-Enumeration sein.The UpdatePanel.RenderMode property must be one of the values of the UpdatePanelRenderMode enumeration. Der Inhalt eines UpdatePanel -Steuer Elements kann in einem HTML <div> -Element oder einem <span> -Element gerendert werden.The content of an UpdatePanel control can be rendered inside either an HTML <div> element or a <span> element.

Der Standard RenderMode Eigenschafts Wert Blockist.The default RenderMode property value is Block.

Gilt für:

Siehe auch