Solved

ASP.net Wizard Validation Groups

Posted on 2009-05-19
5
832 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

Is Your Active Directory as Secure as You Think?

More than 75% of all records are compromised because of the loss or theft of a privileged credential. Experts have been exploring Active Directory infrastructure to identify key threats and establish best practices for keeping data safe. Attend this month’s webinar to learn more.

Question has a verified solution.

If you are experiencing a similar issue, please ask a related question

Suggested Solutions

Title # Comments Views Activity
Need to pass stored proc parameters in list 13 33
Split in Javascript 5 31
ASP.net Javascript use multiple sliders 2 19
C# Single Form 8 28
This article is for Object-Oriented Programming (OOP) beginners. An Interface contains declarations of events, indexers, methods and/or properties. Any class which implements the Interface should provide the concrete implementation for each Inter…
Real-time is more about the business, not the technology. In day-to-day life, to make real-time decisions like buying or investing, business needs the latest information(e.g. Gold Rate/Stock Rate). Unlike traditional days, you need not wait for a fe…
This Micro Tutorial will teach you how to censor certain areas of your screen. The example in this video will show a little boy's face being blurred. This will be demonstrated using Adobe Premiere Pro CS6.
With the power of JIRA, there's an unlimited number of ways you can customize it, use it and benefit from it. With that in mind, there's bound to be things that I wasn't able to cover in this course. With this summary we'll look at some places to go…

867 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

13 Experts available now in Live!

Get 1:1 Help Now