• Status: Solved
  • Priority: Medium
  • Security: Public
  • Views: 300
  • Last Modified:

asp.net form "MoveNext" button to go to specific step based on user input

I have an asp.net form that has about 7 steps. I need help with code for step skipping. The scenario:

On step 1, I have a a few radio input controls. Now, based on the radio answer selection in step 1 I want my <asp:ImageButton ID="ContinueButton0" runat="server" CommandName="MoveNext" ImageUrl="continue.jpg" /> to go to a specific step.

Lets say user answers Yes for radio question 1 in step 1, then "MoveNext" goes to step 2. But if user answers No for radio question 1 in step 1, then "MoveNext" goes to step 3.

Also I'd like to have "MovePrevious" go back to the last step the user was in. For example, if user went from step 1 to step 3 because of his answer selection, if user clicks go back ("MovePrevious") it should take him back to step 1, not to step 2.

I've been stuck trying to do this forever >.<

Thanks so much ahead of time!!! :D
0
igotstehsolution
Asked:
igotstehsolution
  • 3
  • 2
1 Solution
 
robastaCommented:
Are you using the wizard control? [http://weblogs.asp.net/scottgu/archive/2006/02/21/438732.aspx], if not, i suggest you do.
0
 
igotstehsolutionAuthor Commented:
Yes, I am using <asp:wizard>, which means each step is in a <asp:WizardStep>
0
 
robastaCommented:
Do something like this (depending on your control IDs)

 protected void Wizard1_NextButtonClick(object sender, WizardNavigationEventArgs e)
        {
         if (CheckBox1.Checked && e.CurrentStepIndex == 2)
            {
                Wizard1.MoveTo(WizardStep3);
            }
        }

0
Cloud Class® Course: Certified Penetration Testing

This CPTE Certified Penetration Testing Engineer course covers everything you need to know about becoming a Certified Penetration Testing Engineer. Career Path: Professional roles include Ethical Hackers, Security Consultants, System Administrators, and Chief Security Officers.

 
igotstehsolutionAuthor Commented:
my control is: <input type="radio" id="websiteYes" onclick="slidedown('webAdd'); slidedown('webUpgAns');" name="website" />Yes


so I have:

protected void ContinueButton0_Click(object sender, ImageClickEventArgs e)
    {
        if (websiteYes.Selected)
        {
            Wizard1.MoveTo(WizardStep3);
        }
    }



But it says 'websiteYes' does not exist in the current context.

It is the ID for the input control though so I don't understand why =/
0
 
drypzCommented:
Hi! You may add runat='server' attribute. Something like

<input type="radio" runat="server"  id="websiteYes" onclick="slidedown('webAdd'); slidedown('webUpgAns');" name="website" />
0
 
igotstehsolutionAuthor Commented:
thanks.
0
Question has a verified solution.

Are you are experiencing a similar issue? Get a personalized answer when you ask a related question.

Have a better answer? Share it in a comment.

Join & Write a Comment

Featured Post

Free Tool: IP Lookup

Get more info about an IP address or domain name, such as organization, abuse contacts and geolocation.

One of a set of tools we are providing to everyone as a way of saying thank you for being a part of the community.

  • 3
  • 2
Tackle projects and never again get stuck behind a technical roadblock.
Join Now