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
Solved

ASP.net Wizard Validation Groups

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

Announcing the Most Valuable Experts of 2016

MVEs are more concerned with the satisfaction of those they help than with the considerable points they can earn. They are the types of people you feel privileged to call colleagues. Join us in honoring this amazing group of Experts.

Question has a verified solution.

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

Today is the age of broadband.  More and more people are going this route determined to experience the web and it’s multitude of services as quickly and painlessly as possible. Coupled with the move to broadband, people are experiencing the web via …
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!
A short tutorial showing how to set up an email signature in Outlook on the Web (previously known as OWA). For free email signatures designs, visit https://www.mail-signatures.com/articles/signature-templates/?sts=6651 If you want to manage em…
In a recent question (https://www.experts-exchange.com/questions/29004105/Run-AutoHotkey-script-directly-from-Notepad.html) here at Experts Exchange, a member asked how to run an AutoHotkey script (.AHK) directly from Notepad++ (aka NPP). This video…

840 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