Solved

ASP.net Wizard Validation Groups

Posted on 2009-05-19
5
830 Views
Last Modified: 2012-05-07
I am utilizing a wizard for a registration process.  Each step has a validation group.  When looking at the page, it shows the required fields, however, when clicking on "Next" in the wizard, it does not stop the process until the required fields are filled in.  How do I check the validation group for a step when clicking the "Next button?"  

I tried using the UserWizard_NextButtonClick event, but it did not seem to work.
protected void UserWizard_NextButtonClick(object sender, WizardNavigationEventArgs e)

    {
 
 

        if (UserWizard.WizardSteps[e.CurrentStepIndex].ID == "PersonalInfo")

        {
 

            GetValidators("Personal");

        }

}

Open in new window

0
Comment
Question by:Dukster131
  • 3
5 Comments
 
LVL 9

Accepted Solution

by:
VikramMullick earned 500 total points
ID: 24423863
0
 
LVL 7

Expert Comment

by:NicoJuicy
ID: 24423916
Code behind on the page.


if xx.IsValid then

       go to nextstep

end if

Open in new window

0
 
LVL 1

Author Comment

by:Dukster131
ID: 24424477
This helped for StartNavigationTemplate and One of the StepNavigationTemplates.  I have several steps in the wizard and each one has its own validation group.  How do I distinguish the steps?

Here is what I now have:

<StartNavigationTemplate>
<asp:Button ID="btnPrevious" runat="server" Text="Previous" CommandName="MovePrevious" />
<asp:Button ID ="btnNext" runat="server" Text="Next Step" CommandName="MoveNext" CausesValidation="true" ValidationGroup="Personal" />
</StartNavigationTemplate>
<StepNavigationTemplate>
<asp:Button ID="btnPrevious" runat="server" Text="Previous" CommandName="MovePrevious" />
<asp:Button ID ="btnNext" runat="server" Text="Next Step" CommandName="MoveNext" CausesValidation="true" ValidationGroup="Military" />

</StepNavigationTemplate>
0
 
LVL 1

Author Comment

by:Dukster131
ID: 24425471
Ok.  I think I got it.  I used the following in the code behind and it seemed to work.

if (UserWizard.WizardSteps[e.CurrentStepIndex].ID == "MoreInfo")
        {

            Page.Validate("More");
        }
        if (UserWizard.WizardSteps[e.CurrentStepIndex].ID == "Experience")
        {

            Page.Validate("Experience");
        }
        if (UserWizard.WizardSteps[e.CurrentStepIndex].ID == "MilED")
        {

            Page.Validate("MilEd");
        }
        if (!Page.IsValid)
        {
            e.Cancel = true;
        }

Thanks for pointing me in the right direction.
0
 
LVL 1

Author Closing Comment

by:Dukster131
ID: 31583087
Thanks for pointing me in the right direction
0

Featured Post

Do You Know the 4 Main Threat Actor Types?

Do you know the main threat actor types? Most attackers fall into one of four categories, each with their own favored tactics, techniques, and procedures.

Join & Write a Comment

Suggested Solutions

Problem Hi all,    While many today have fast Internet connection, there are many still who do not, or are connecting through devices with a slower connect, so light web pages and fast load times are still popular.    If your ASP.NET page …
Exception Handling is in the core of any application that is able to dignify its name. In this article, I'll guide you through the process of writing a DRY (Don't Repeat Yourself) Exception Handling mechanism, using Aspect Oriented Programming.
This video discusses moving either the default database or any database to a new volume.
Illustrator's Shape Builder tool will let you combine shapes visually and interactively. This video shows the Mac version, but the tool works the same way in Windows. To follow along with this video, you can draw your own shapes or download the file…

759 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question

Need Help in Real-Time?

Connect with top rated Experts

21 Experts available now in Live!

Get 1:1 Help Now