Dynamic HeaderText for an ASP.NET 2.0 Wizard Control

I wanted to have the Wizard Control Header display the current step’s title, after a little research I found that the ActiveStepChanged event would allow me to do this. So I added an event handler like this:
    Protected Sub Wizard1_ActiveStepChanged(ByVal sender As Object, ByVal e As System.EventArgs) Handles Wizard1.ActiveStepChanged
        Me.Wizard1.HeaderText = Me.Wizard1.ActiveStep.Title
    End Sub

Except it didn’t set the Header for the first step so I set the HeaderText manually to the first step’s title like this:
    <asp:Wizard ID="Wizard1" runat="server" HeaderText="Step 1"> 
        <WizardSteps> 
            <asp:WizardStep ID="WizardStep1" runat="server" Title="Step 1"> 
            </asp:WizardStep> 
            <asp:WizardStep ID="WizardStep2" runat="server" Title="Step 2"> 
            </asp:WizardStep> 
        </WizardSteps> 
    </asp:Wizard>

No comments:

Post a Comment