Why Experts Exchange?

Experts Exchange always has the answer, or at the least points me in the correct direction! It is like having another employee that is extremely experienced.

Jim Murphy
Programmer at Smart IT Solutions

When asked, what has been your best career decision?

Deciding to stick with EE.

Mohamed Asif
Technical Department Head

Being involved with EE helped me to grow personally and professionally.

Carl Webster
CTP, Sr Infrastructure Consultant
Ask ANY Question

Connect with Certified Experts to gain insight and support on specific technology challenges including:

Professional Opinions
Ask a Question
Did You Know?

We've partnered with two important charities to provide clean water and computer science education to those who need it most. READ MORE

troubleshooting Question

Validate wizard data against database

Avatar of sglew
sglewFlag for United States of America asked on
Microsoft SQL ServerASP.NETVisual Basic.NET
2 Comments1 Solution354 ViewsLast Modified:

I'm working on setting up a web page with a wizard control and I have it laid out the way I want it to be and now I'm going back and trying to add the data validation.  The very first step in the process is one where a person enters a given promo code and before they move onto the next step I need to be able to verify that 1) the code is valid and 2) the code hasn't already been used.  I have the proper code built into my Wizard1_StartNextButtonClick routine to verify the data but I'm not exactly sure how to set the process up to revert back to first step when an error is found in the code.

What currently happens when I hit the next button is that it goes to the next step even though the code is incorrect or has already been used.  I can verify that much by clicking on the left navigation of the Wizard to get back to the first step and see that my error label is populated with the error message.  As you can see in my if statement I tried to set the "ActiveStepIndex" back to zero but it still moves to the next step.

Is there something I am missing when it comes to validating data entered?  Should I use a different method to validate this data?

If codecount = 0 then
    Wizard1.ActiveStepIndex = 0
    lblCodeError.Text = "The code you entered is invalid, please double check your code and try again."
ElseIf codecountUsed = 1
    Wizard1.ActiveStepIndex = 0
    lblCodeError.Text = "The code you entered has already been used. You can only use your code once."
End If
Avatar of sglew
sglewFlag of United States of America image

Our community of experts have been thoroughly vetted for their expertise and industry experience.

This problem has been solved!
Unlock 1 Answer and 2 Comments.
See Answers