tags:

views:

53

answers:

1

I am using a WizardControl in .NET 2.0. On the first Step (which is set to StepType="Start") when the next button is clicked, I run server-side validation code. But, no matter what I do it keeps going to the next step. Here is my code:

    Protected Sub Wizard1_NextButtonClick(ByVal sender As Object, ByVal e As System.Web.UI.WebControls.WizardNavigationEventArgs) Handles Wizard1.NextButtonClick

    Dim oUser As New BE.User

    Select Case Wizard1.ActiveStepIndex

        Case 0

            If Membership.FindUsersByName(UserName.Text).Count = 0 Then

                oUser.UserName = UserName.Text
                oUser.Password = Password.Text
                oUser.Email = Email.Text

                Wizard1.ActiveStepIndex = 1
            Else
                Wizard1.ActiveStepIndex = 0
                ErrorMessage.Text = "user name already in use"
            End If
        Case 1

        Case 2


    End Select
End Sub
A: 

The Wizard control's NextButtonClick event has a "WizardNavigationEventArgs" parameter that contains a "Cancel" property help to cancel the current next navigation operation.

courtesy of

Steven Cheng Microsoft Online Support