Wizard.ActiveStep Properti
Definisi
Penting
Beberapa informasi terkait produk prarilis yang dapat diubah secara signifikan sebelum dirilis. Microsoft tidak memberikan jaminan, tersirat maupun tersurat, sehubungan dengan informasi yang diberikan di sini.
Mendapatkan langkah dalam WizardSteps koleksi yang saat ini ditampilkan kepada pengguna.
public:
property System::Web::UI::WebControls::WizardStepBase ^ ActiveStep { System::Web::UI::WebControls::WizardStepBase ^ get(); };
[System.ComponentModel.Browsable(false)]
public System.Web.UI.WebControls.WizardStepBase ActiveStep { get; }
[<System.ComponentModel.Browsable(false)>]
member this.ActiveStep : System.Web.UI.WebControls.WizardStepBase
Public ReadOnly Property ActiveStep As WizardStepBase
Nilai Properti
WizardStepBase yang saat ini ditampilkan kepada pengguna.
- Atribut
Pengecualian
Yang sesuai ActiveStepIndex kurang dari -1 atau lebih besar dari jumlah WizardStepBase objek di Wizard.
Contoh
Contoh kode berikut menunjukkan cara menggunakan ActiveStep properti untuk menentukan langkah mana yang akan ditetapkan sebagai properti Wizard kontrol berikutnyaActiveStep. Jika nilai CheckBox1.Checked
adalah true
, ActiveStep properti diatur ke Wizard1.Step3
; jika tidak, ActiveStep properti diatur ke Wizard1.Step2
.
<%@ 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 OnActiveStepChanged(object sender, EventArgs e)
{
// If the ActiveStep is changing to Step2 check to see if the
// CheckBox1 CheckBox is checked. If it is then skip
// to the Step3 step.
if (Wizard1.ActiveStep == this.WizardStep2)
{
if (this.CheckBox1.Checked)
{
Wizard1.ActiveStepIndex = Wizard1.WizardSteps.IndexOf(this.WizardStep3);
}
}
}
</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"
OnActiveStepChanged="OnActiveStepChanged">
<WizardSteps>
<asp:WizardStep ID="WizardStep1"
Title="Step 1"
Runat="server">
<asp:CheckBox ID="CheckBox1"
Runat="Server"
Text="Check this checkbox to skip Step 2." />
You are currently on Step 1.
</asp:WizardStep>
<asp:WizardStep ID="WizardStep2"
Title="Step 2"
Runat="server">
You are currently on Step 2.
</asp:WizardStep>
<asp:WizardStep ID="WizardStep3"
Runat="server"
Title="Step 3">
You are currently on Step 3.
</asp:WizardStep>
</WizardSteps>
<HeaderTemplate>
<b>ActiveStepIndex 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 OnActiveStepChanged(ByVal sender As Object, ByVal e As EventArgs)
' If the ActiveStep is changing to Step2 check to see if the
' CheckBox1 CheckBox is checked. If it is then skip
' to the Step3 step.
If Wizard1.ActiveStep.Equals(Me.WizardStep2) Then
If (Me.CheckBox1.Checked) Then
Wizard1.ActiveStepIndex = Wizard1.WizardSteps.IndexOf(Me.WizardStep3)
End If
End If
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"
OnActiveStepChanged="OnActiveStepChanged">
<WizardSteps>
<asp:WizardStep ID="WizardStep1"
Title="Step 1"
Runat="server">
<asp:CheckBox ID="CheckBox1"
Runat="Server"
Text="Check this checkbox to skip Step 2." />
You are currently on Step 1.
</asp:WizardStep>
<asp:WizardStep ID="WizardStep2"
Title="Step 2"
Runat="server">
You are currently on Step 2.
</asp:WizardStep>
<asp:WizardStep ID="WizardStep3"
Runat="server"
Title="Step 3">
You are currently on Step 3.
</asp:WizardStep>
</WizardSteps>
<HeaderTemplate>
<b>ActiveStepIndex Example</b>
</HeaderTemplate>
</asp:Wizard>
</form>
</body>
</html>
Keterangan
Properti ActiveStep mengembalikan WizardStepBase objek yang saat ini ditampilkan dalam Wizard kontrol. Properti ActiveStep bersifat baca-saja; namun, Anda dapat menggunakan ActiveStep properti untuk mengakses properti objek saat ini WizardStepBase . ActiveStepIndex Gunakan properti untuk mengubah ActiveStep secara dinamis ke objek yang berbedaWizardStepBase. Atau, Anda dapat menggunakan MoveTo metode untuk mengatur ActiveStep properti secara dinamis.