I have a web site (ASP.NET, no MVC) with multiple web forms for filling out data for customers wizardry style.
Let’s say I have Form1, Form2, Form3, Form4, Form5, Form6, form7
All but first and last forms have a Next and Previous button with simple code for redirect, for example on Form4
btnNext_Click -> Response.Redirect("Form5.aspx");
btnPrevious_Click -> Response.Redirect("Form3.aspx");
Works fine but on the first form there’s a radiobutton list and depending on what’s been selected some forms should be skipped so I can’t hard code the navigation anymore. I.e.
if radiobutton 1 is selected then the wizard would be
Form1 -> Form2 -> Form6 -> Form7
if radiobutton 2 is selected then the wizard would be
Form2- > Form3 -> Form7
Radiobutton list is customer type and will be saved to the DB with the rest of the data.
Not looking for complete code sample but more so how you would go on about doing this?
Create a separate class with Switch .. Case code to handle the appropriate code branching.
Create an instance of this class and pass the selected option as parameter. In your Web Form’s Next Button Click, call the method of this class.