依次多个web形式之间有条件的导航? [英] Conditional navigation between multiple web forms in sequence?

查看:115
本文介绍了依次多个web形式之间有条件的导航?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我有一个网站(ASP.NET,没有MVC)与多个网络形式,为客户巫术式的填写数据。

I have a web site (ASP.NET, no MVC) with multiple web forms for filling out data for customers wizardry style.

让我们说我有 Form1上,窗体2,Form3,Form4,Form5,Form6,form7
所有,但第一个和最后的形式与简单code为重定向下一步,previous按钮,例如在Form4

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");

工作正常,但第一个表单上有一个单选按钮列表,并根据公司选择了什么样某些形式应该被跳过,所以我不能硬code导航了。即
如果选择单选按钮1,则该向导会

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

如果单选按钮2被选择则向导会

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.

不找完整code样品,但越是这样,你怎么会去这样做呢?

Not looking for complete code sample but more so how you would go on about doing this?

推荐答案

创建开关一个单独的类..案例code来处理相应的code分支。

Create a separate class with Switch .. Case code to handle the appropriate code branching.

class OpenWebForm
{
    protected void SelectForm(string option)
    {
        switch (option)
        {
            case "1":

                break;

            case "2":

                break:

        }

    }
}

创建这个类的一个实例,并通过所选择的选项作为参数。在您的Web窗体的单击下一步按钮,调用这个类的方法。

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.

这篇关于依次多个web形式之间有条件的导航?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆