UpdatePanelRenderMode 枚举
定义
重要
一些信息与预发行产品相关,相应产品在发行之前可能会进行重大修改。 对于此处提供的信息,Microsoft 不作任何明示或暗示的担保。
表示页上 UpdatePanel 控件内容的可能的布局呈现选项。
public enum class UpdatePanelRenderMode
public enum UpdatePanelRenderMode
type UpdatePanelRenderMode =
Public Enum UpdatePanelRenderMode
- 继承
字段
Block | 0 | 指定将 UpdatePanel 控件内容呈现在 HTML 元素 |
Inline | 1 | 指定将 UpdatePanel 控件内容呈现在 HTML 元素 |
示例
下面的示例演示如何以声明方式将 UpdatePanel.RenderMode 属性设置为 Inline
. 该 UpdatePanel 控件包含一个字符串,表示页中的回发数。 内容与周围的文本内联呈现。
<%@ 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>
注解
枚举 UpdatePanelRenderMode
定义用于将控件内容括起来的 UpdatePanel HTML 元素。 该 UpdatePanel.RenderMode 属性必须是枚举的值 UpdatePanelRenderMode
之一。 控件的内容 UpdatePanel 可以在 HTML <div>
元素或 <span>
元素内呈现。
默认 RenderMode 属性值为 Block
.