如何创建与Webforms Wizards功能类似的MVC"向导"?

Vik*_*kas 3 asp.net-mvc

我想在ASP.NET MVC中创建一个类似于ASP.NET webforms中的向导控制功能的向导.

做这个的最好方式是什么?

Ole*_*nge 6

使用ASP.NET MVC,我建议使用javascript/jquery在网页中创建向导; 就像是

<script type="text/javascript">
    $().ready(InitializeWizard);
    function InitializeWizard() {
        $(".step").hide();
        $("#step1").show();
    }
    function Step1OK() {
        $("#step1").hide();
        $("#step2").show();
    }
    function Step2OK() {
        $("#step2").hide();
        $("#stepComplete").show();
    }
</script>

<div id="step1" class="step">
    Step 1
    <input type="button" onclick="Step1OK();" value="OK" />
</div>
<div id="step2" class="step">
    Step 2
    <input type="button" onclick="Step2OK();" value="OK" />
</div>
<div id="stepComplete" class="step">
    Complete
</div>
Run Code Online (Sandbox Code Playgroud)

NB!请记住,在文档的顶部,加载jquery,例如通过引用google链接:

<script src="http://www.google.com/jsapi"></script>
<script>
    google.load("jquery", "1.3.2");
</script>
Run Code Online (Sandbox Code Playgroud)