Wizard.FinishNavigationTemplate 属性

定义

获取或设置在 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,定义 FinishWizard 的导航区域的内容。 默认值为 null

属性

示例

下面的代码示例演示如何使用 FinishNavigationTemplate 属性为 控件的步骤WizardFinish导航区域创建自定义模板。

重要

此示例具有一个接受用户输入的文本框,这是一个潜在的安全威胁。 默认情况下,ASP.NET 网页验证用户输入是否不包含脚本或 HTML 元素。 有关详细信息,请参阅脚本侵入概述

<%@ 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使用 属性可指定控件步骤WizardFinish为导航区域显示的自定义内容。 通过创建一个模板来定义内容,该模板指定在步骤中 Finish 如何呈现导航区域。

模板的自定义内容包含在 对象中 FinishNavigationTemplate 。 可以通过在设计视图中使用模板编辑模式或使用标记内联FinishNavigationTemplate定义FinishNavigationTemplate对象,向对象添加自定义内容FinishNavigationTemplate。 内容可以像纯文本一样简单,也可以是更复杂的 (在模板中嵌入其他控件,例如) 。

注意

FinishNavigationTemplate属性中包含的 FinishNavigationTemplate 对象必须包含两IButtonControl个控件,一个控件的 CommandName 属性设置为“MoveComplete”,另一个属性CommandName设置为“MovePrevious”,以便启用导航功能。

若要以编程方式访问模板中定义的控件,请使用 Controls 对象的 集合 Wizard 。 如果控件指定了ID属性,则还可以使用 FindControl 对象的 方法来Wizard查找控件。

适用于

另请参阅