?
Solved

ASP.net Wizard Validation Groups

Posted on 2009-05-19
5
Medium Priority
?
841 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
[X]
Welcome to Experts Exchange

Add your voice to the tech community where 5M+ people just like you are talking about what matters.

  • Help others & share knowledge
  • Earn cash & points
  • Learn & ask questions
  • 3
5 Comments
 
LVL 9

Accepted Solution

by:
VikramMullick earned 1500 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

Technology Partners: We Want Your Opinion!

We value your feedback.

Take our survey and automatically be enter to win anyone of the following:
Yeti Cooler, Amazon eGift Card, and Movie eGift Card!

Question has a verified solution.

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

Introduction This article shows how to use the open source plupload control to upload multiple images. The images are resized on the client side before uploading and the upload is done in chunks. Background I had to provide a way for user…
Entity Framework is a powerful tool to help you interact with the DataBase but still doesn't help much when we have a Stored Procedure that returns more than one resultset. The solution takes some of out-of-the-box thinking; read on!
This tutorial will teach you the special effect of super speed similar to the fictional character Wally West aka "The Flash" After Shake : http://www.videocopilot.net/presets/after_shake/ All lightning effects with instructions : http://www.mediaf…
Sometimes it takes a new vantage point, apart from our everyday security practices, to truly see our Active Directory (AD) vulnerabilities. We get used to implementing the same techniques and checking the same areas for a breach. This pattern can re…
Suggested Courses
Course of the Month8 days, 22 hours left to enroll

765 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