Wizard.FinishNavigationTemplate 屬性
定義
重要
部分資訊涉及發行前產品,在發行之前可能會有大幅修改。 Microsoft 對此處提供的資訊,不做任何明確或隱含的瑕疵擔保。
取得或設定用來在 Finish 步驟顯示巡覽區域的樣板。
public:
virtual property System::Web::UI::ITemplate ^ FinishNavigationTemplate { System::Web::UI::ITemplate ^ get(); void set(System::Web::UI::ITemplate ^ value); };
[System.ComponentModel.Browsable(false)]
[System.Web.UI.PersistenceMode(System.Web.UI.PersistenceMode.InnerProperty)]
[System.Web.UI.TemplateContainer(typeof(System.Web.UI.WebControls.Wizard))]
public virtual System.Web.UI.ITemplate FinishNavigationTemplate { get; set; }
[<System.ComponentModel.Browsable(false)>]
[<System.Web.UI.PersistenceMode(System.Web.UI.PersistenceMode.InnerProperty)>]
[<System.Web.UI.TemplateContainer(typeof(System.Web.UI.WebControls.Wizard))>]
member this.FinishNavigationTemplate : System.Web.UI.ITemplate with get, set
Public Overridable Property FinishNavigationTemplate As ITemplate
屬性值
在 ITemplate 上定義 Finish 之巡覽區域內容的 Wizard。 預設為 null
。
- 屬性
範例
下列程式代碼範例示範如何使用 FinishNavigationTemplate 屬性,為控件之 Finish 步驟 Wizard 的導覽區域建立自定義範本。
重要
這個範例有一個可接受使用者輸入的文字方塊,這可能會造成安全性威脅。 根據預設,ASP.NET Web 網頁會驗證使用者輸入未包含指令碼或 HTML 項目。 如需詳細資訊,請參閱 Script Exploits Overview (指令碼攻擊概觀)。
<%@ 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">
void OnFinishButtonClick(object sender, EventArgs e)
{
// Insert code here that determines if an email address was
// entered in emailTextBox. Then send an confirmation email if it was.
}
</script>
<html xmlns="http://www.w3.org/1999/xhtml" >
<head runat="server">
<title>ASP.NET Example</title>
</head>
<body>
<form id="form1"
title="FinishNavigationTemplate Example"
runat="server">
<asp:Wizard ID="Wizard1"
Runat="server"
ActiveStepIndex="0"
OnFinishButtonClick="OnFinishButtonClick">
<WizardSteps>
<asp:WizardStep Runat="server"
Title="Step 1">
<!-- Put UI elements for Step 1 here. -->
This is step one.
</asp:WizardStep>
<asp:WizardStep Runat="server"
Title="Step 2">
<!-- Put UI elements for Step 2 here. -->
This is step two.
</asp:WizardStep>
<asp:WizardStep Runat="server"
StepType="Complete"
Title="Complete">
The Wizard has been completed.
</asp:WizardStep>
</WizardSteps>
<FinishNavigationTemplate>
Please enter your email address if you would like a confirmation email:
<asp:TextBox ID="emailTextBox"
Runat="server">
</asp:TextBox>
<br />
<asp:Button CommandName="MovePrevious"
Runat="server"
Text="Previous" />
<asp:Button CommandName="MoveComplete"
Runat="server"
Text="Finish" />
</FinishNavigationTemplate>
<HeaderTemplate>
<b>FinishNavigationTemplate Example</b>
</HeaderTemplate>
</asp:Wizard>
</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">
Sub OnFinishButtonClick(ByVal sender As Object, ByVal e As WizardNavigationEventArgs)
' Insert code here that determines if an email address was
' entered in emailTextBox. Then send an confirmation email if it was.
End Sub
</script>
<html xmlns="http://www.w3.org/1999/xhtml" >
<head runat="server">
<title>ASP.NET Example</title>
</head>
<body>
<form id="form1"
title="FinishNavigationTemplate Example"
runat="server">
<asp:Wizard ID="Wizard1"
Runat="server"
ActiveStepIndex="0"
OnFinishButtonClick="OnFinishButtonClick">
<WizardSteps>
<asp:WizardStep Runat="server"
Title="Step 1">
<!-- Put UI elements for Step 1 here. -->
This is step one.
</asp:WizardStep>
<asp:WizardStep Runat="server"
Title="Step 2">
<!-- Put UI elements for Step 2 here. -->
This is step two.
</asp:WizardStep>
<asp:WizardStep Runat="server"
StepType="Complete"
Title="Complete">
The Wizard has been completed.
</asp:WizardStep>
</WizardSteps>
<FinishNavigationTemplate>
Please enter your email address if you would like a confirmation email:
<asp:TextBox ID="emailTextBox"
Runat="server">
</asp:TextBox>
<br />
<asp:Button CommandName="MovePrevious"
Runat="server"
Text="Previous" />
<asp:Button CommandName="MoveComplete"
Runat="server"
Text="Finish" />
</FinishNavigationTemplate>
<HeaderTemplate>
<b>FinishNavigationTemplate Example</b>
</HeaderTemplate>
</asp:Wizard>
</form>
</body>
</html>
備註
FinishNavigationTemplate使用屬性來指定控件步驟Wizard上Finish巡覽區域所顯示的自定義內容。 藉由建立範本來定義內容,以指定如何在步驟上 Finish 呈現導覽區域。
範本的自定義內容包含在物件內 FinishNavigationTemplate 。 您可以在設計檢視中使用範本編輯模式,或使用標記內嵌FinishNavigationTemplate
定義FinishNavigationTemplate物件,將自定義內容新增至FinishNavigationTemplate物件。 內容可以像純文本一樣簡單,或更複雜的 (在範本中內嵌其他控制件,例如) 。
注意
屬性 FinishNavigationTemplate 中包含的 FinishNavigationTemplate 對象必須包含兩 IButtonControl 個控件,其中一個控件的 CommandName 屬性設定為 “MoveComplete”,另一個控件的 CommandName 屬性設定為 “MovePrevious”,以啟用流覽功能。
若要以程式設計方式存取範本中定義的控制項,請使用 Controls 物件的集合 Wizard 。 如果控件已ID指定屬性,您也可以使用 FindControl 物件的 方法來Wizard尋找控件。