Wizard.GetStepType(WizardStepBase, Int32) Metodo

Definizione

Restituisce il valore WizardStepType per l'oggetto WizardStepBase specificato.

C#
public System.Web.UI.WebControls.WizardStepType GetStepType(System.Web.UI.WebControls.WizardStepBase wizardStep, int index);

Parametri

wizardStep
WizardStepBase

Oggetto WizardStepBase per il quale viene restituito l'oggetto WizardStepType associato.

index
Int32

Indice dell'oggetto WizardStepBase per il quale viene restituito l'oggetto WizardStepType associato.

Restituisce

Uno dei valori di WizardStepType.

Esempio

Nell'esempio di codice seguente viene illustrato come utilizzare il GetStepType metodo per determinare il valore associato WizardStepType per il passaggio corrente del Wizard controllo. Ogni volta che viene generato l'evento ActiveStepChanged , viene recuperato il nuovo WizardStepType valore e viene scritto un messaggio in Label1.

ASP.NET (C#)
<%@ 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)
  { 
    Label tempLabel = (Label)Wizard1.FindControl("Label1");
    if (tempLabel != null)
    {
      // Get the step type of the ActiveStep and write it to Label1.
      WizardStepType tempStepType = Wizard1.GetStepType(Wizard1.ActiveStep, Wizard1.ActiveStepIndex);
      tempLabel.Text = "The current step type is " + tempStepType.ToString() + ".";
    }   
  }
  
</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:WizardStep>
            <asp:WizardStep id="WizardStep2" 
              title="Step 2" 
              runat="server">
            </asp:WizardStep>
            <asp:WizardStep id="WizardStep3" 
              runat="server" 
              title="Step 3">
            </asp:WizardStep>
          </WizardSteps>
          <HeaderTemplate>
            <b>GetStepType Example</b>
             <br />
            <asp:Label id="Label1" 
              runat="server" 
              width="208px" 
              height="19px">
            </asp:Label>
          </HeaderTemplate>
        </asp:Wizard>
      </form>
  </body>
</html>

Commenti

Utilizzare il GetStepType metodo per determinare il WizardStepType valore dell'oggetto specificato WizardStepBase .

Si applica a

Prodotto Versioni
.NET Framework 2.0, 3.0, 3.5, 4.0, 4.5, 4.5.1, 4.5.2, 4.6, 4.6.1, 4.6.2, 4.7, 4.7.1, 4.7.2, 4.8, 4.8.1

Vedi anche