Wizard.OnFinishButtonClick(WizardNavigationEventArgs) 方法
定義
重要
部分資訊涉及發行前產品,在發行之前可能會有大幅修改。 Microsoft 對此處提供的資訊,不做任何明確或隱含的瑕疵擔保。
引發 FinishButtonClick 事件。
protected:
virtual void OnFinishButtonClick(System::Web::UI::WebControls::WizardNavigationEventArgs ^ e);
protected virtual void OnFinishButtonClick (System.Web.UI.WebControls.WizardNavigationEventArgs e);
abstract member OnFinishButtonClick : System.Web.UI.WebControls.WizardNavigationEventArgs -> unit
override this.OnFinishButtonClick : System.Web.UI.WebControls.WizardNavigationEventArgs -> unit
Protected Overridable Sub OnFinishButtonClick (e As WizardNavigationEventArgs)
參數
範例
下列程式代碼範例示範如何指定 事件的事件處理程式 FinishButtonClick 。 按兩下 [ 完成] 按鈕時,會寫入 Label1
確認訊息,並將 Label1.Visible
屬性設定為 true
,以便在步驟上顯示訊息。
<%@ 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, WizardNavigationEventArgs e)
{
// When the Finish button is clicked, write a confirmation
// that the wizard was completed to Label1, and make it visible.
Label1.Text = "The wizard has been completed.";
Label1.Visible = true;
}
</script>
<html xmlns="http://www.w3.org/1999/xhtml" >
<head runat="server">
<title>ASP.NET Example</title>
</head>
<body>
<form id="form1" runat="server">
<asp:Wizard id="Wizard1"
runat="server"
onfinishbuttonclick="OnFinishButtonClick">
<WizardSteps>
<asp:WizardStep id="WizardStep1"
title="Step 1"
runat="server">
</asp:WizardStep>
<asp:WizardStep id="WizardStep2"
title="Step 2"
runat="server">
</asp:WizardStep>
</WizardSteps>
<HeaderTemplate>
<b>FinishButtonClick Example</b>
</HeaderTemplate>
</asp:Wizard>
<asp:Label id="Label1"
runat="Server"
visible="False" />
</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)
' When the Finish button is clicked, write a confirmation
' that the wizard was completed to Label1, and make it visible.
Label1.Text = "The wizard has been completed."
Label1.Visible = True
End Sub
</script>
<html xmlns="http://www.w3.org/1999/xhtml" >
<head runat="server">
<title>ASP.NET Example</title>
</head>
<body>
<form id="form1" runat="server">
<asp:Wizard id="Wizard1"
runat="server"
onfinishbuttonclick="OnFinishButtonClick">
<WizardSteps>
<asp:WizardStep id="WizardStep1"
title="Step 1"
runat="server">
</asp:WizardStep>
<asp:WizardStep id="WizardStep2"
title="Step 2"
runat="server">
</asp:WizardStep>
</WizardSteps>
<HeaderTemplate>
<b>FinishButtonClick Example</b>
</HeaderTemplate>
</asp:Wizard>
<asp:Label id="Label1"
runat="Server"
visible="False" />
</form>
</body>
</html>
備註
按兩下 [完成] 按鈕時,就會FinishButtonClick引發 事件。
引發事件會透過委派叫用此事件處理常式。 如需詳細資訊,請參閱 處理和引發事件。
OnFinishButtonClick 方法也允許衍生類別處理事件,而不用附加委派。 這是在衍生類別中處理事件的慣用技巧。
給繼承者的注意事項
在 OnFinishButtonClick(WizardNavigationEventArgs) 衍生類別中覆寫 方法時,請務必呼叫 OnFinishButtonClick(WizardNavigationEventArgs) 基類的方法,讓已註冊的委派接收 事件。