如何创建一个MVC'向导'在功能上Web表单向导相似? [英] How do I create a MVC 'Wizard' similar in functionality to Webforms Wizards?

查看:208
本文介绍了如何创建一个MVC'向导'在功能上Web表单向导相似?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我想创建ASP.NET MVC类似于ASP.NET web表单中发现的向导控制功能的向导。

I'd like to create a wizard in ASP.NET MVC similar to the wizard control functionality found in ASP.NET webforms.

什么是做到这一点的最好方法是什么?

What is the best way to do this?

推荐答案

使用ASP.NET MVC我会建议使用javascript / jQuery来创建一个网页一个向导;像

With ASP.NET MVC I would suggest using javascript/jquery to create a wizard in a web page; something like

<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>

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

NB! Remember, in the top of the document, to load jquery, e.g. by referencing the google link:

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

这篇关于如何创建一个MVC'向导'在功能上Web表单向导相似?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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