简体   繁体   English

如何在ASP.net Web表单中使用FuelUX向导

[英]How to use FuelUX wizard in ASP.net webforms

I am very new to web development and using VS2013, ASP.net 4.5.1 WebForms and C#. 我对使用VS2013,ASP.net 4.5.1 WebForms和C#进行Web开发非常陌生。

I have started developing an application and have made a lot of progress. 我已经开始开发应用程序并取得了很大的进步。 I would like to use a wizard design element and have been trying FuelUX wizard . 我想使用向导设计元素,并一直在尝试FuelUX向导 I came across this when using a bootstrap theme Ace - Responsive Admin Template . 在使用引导主题Ace-Responsive管理模板时遇到了这个问题。

As my site uses master pages I have added the reference to the FuelUX.wizard JavaScript file in the tag. 当我的网站使用母版页时,我在标记中添加了对FuelUX.wizard JavaScript文件的引用。 I am not sure if this is the correct or best place. 我不确定这是正确的还是最好的地方。

I also reference the CSS from the sites master page and am happy with the resultant content pages design that is served up. 我还从站点母版页引用了CSS,并对所提供的最终内容页面设计感到满意。

My problem comes when I try to put some action behind the next and previous buttons. 当我尝试在下一个和上一个按钮后面进行一些操作时,就会出现我的问题。 What |I want to achieve is move to the next stage of the wizard when the use clicks 'Next' and the previous stage when the user clicks 'Prev'. 我要实现的是,当用户单击“下一步”时,移至向导的下一个阶段,而当用户单击“上一步”时,移至上一个阶段。 I have read a lot of similar questions but I am missing something because whatever I am doing it is wrong :-( 我读过很多类似的问题,但是我错过了一些东西,因为我所做的一切都是错误的:-(

Questions: 问题:

  1. Where should the reference to the FuelUX.wizard.js go? 对FuelUX.wizard.js的引用应该放在哪里? as I have it or referenced in the content page or something else? 如我在内容页面中引用或引用的内容?
  2. How is it best to consume a function contained in the JavaScript file - can this be done from code behind or does it need to be from the content page? 如何最好地利用JavaScript文件中包含的功能-这可以通过背后的代码完成还是需要从内容页面进行?

I hope this makes sense. 我希望这是有道理的。 Thanks everyone 感谢大家

Site.Master - ScriptManager Site.Master-ScriptManager

<asp:ScriptManager runat="server">
            <Scripts>
                <%--To learn more about bundling scripts in ScriptManager see http://go.microsoft.com/fwlink/?LinkID=301884 --%>
                <%--Framework Scripts--%>
                <asp:ScriptReference Name="MsAjaxBundle" />
                <asp:ScriptReference Name="jquery" />
                <asp:ScriptReference Name="bootstrap" />
                <asp:ScriptReference Name="respond" />
                <asp:ScriptReference Name="WebForms.js" Assembly="System.Web" Path="~/Scripts/WebForms/WebForms.js" />
                <asp:ScriptReference Name="WebUIValidation.js" Assembly="System.Web" Path="~/Scripts/WebForms/WebUIValidation.js" />
                <asp:ScriptReference Name="MenuStandards.js" Assembly="System.Web" Path="~/Scripts/WebForms/MenuStandards.js" />
                <asp:ScriptReference Name="GridView.js" Assembly="System.Web" Path="~/Scripts/WebForms/GridView.js" />
                <asp:ScriptReference Name="DetailsView.js" Assembly="System.Web" Path="~/Scripts/WebForms/DetailsView.js" />
                <asp:ScriptReference Name="TreeView.js" Assembly="System.Web" Path="~/Scripts/WebForms/TreeView.js" />
                <asp:ScriptReference Name="WebParts.js" Assembly="System.Web" Path="~/Scripts/WebForms/WebParts.js" />
                <asp:ScriptReference Name="Focus.js" Assembly="System.Web" Path="~/Scripts/WebForms/Focus.js" />
                <asp:ScriptReference Name="WebFormsBundle" />
                <%--Site Scripts--%>
                <asp:ScriptReference Path="../Scripts/fuelux/fuelux.wizard.js" />

           </Scripts>

MyPage.aspx - partial Markup MyPage.aspx-部分标记

<div id="my-wizard" data-target="#step-container">
    <ul class="wizard-steps">
        <li data-target="#step1" class="active">
            <span class="step">1</span>
            <span class="title">Some details</span>
        </li>
        <li data-target="#step2">
            <span class="step">2</span>
            <span class="title">Some more details</span>
        </li>
    </ul>
</div>
<div class="step-content pos-rel" id="step-container">
    <div class="step-pane active" id="step1">
        <h3 class="lighter block green">Enter the following information</h3>
        <div class="panel panel-primary">
            <div class="panel-heading">
                <h3 class="panel-title">Enter some details</h3>
            </div>
            <div class="panel-body">
                <div class="col-sm-12 form-group">
                    <label class=" control-label" for="aList">A List</label>
                    <select class="form-control" id="aList">
                        <option>1</option>
                        <option>2</option>
                        <option>3</option>
                        <option>4</option>
                        <option>5</option>
                    </select>
                </div>
                <div class="col-sm-12 form-group">
                    <label class=" control-label" for="something">Add Something</label>
                    <input class="form-control" id="something" type="text" placeholder="Enter Something">
                </div>
            </div>
        </div>

    </div>
   <div class="step-pane" id="step2">
        <div class="panel panel-primary">
            <div class="panel-heading">
                <h3 class="panel-title">Some more details</h3>
            </div>
            <div class="panel-body">
               <div class="col-sm-12 form-group">
                    <label class=" control-label" for="enterSomethingelse">Enter something else</label>
                    <input class="form-control" id="enterSomethingelse" type="text" placeholder="Enter something else here">
                </div>
           </div>
        </div>
    </div>
</div>
<div class="wizard-actions">
     <button class="btn btn-prev">
        <i class="ace-icon fa fa-arrow-left"></i>
        Prev
    </button>

    <button class="btn btn-success btn-next" data-last="Finish">
        Next
        <i class="ace-icon fa fa-arrow-right icon-on-right"></i>
    </button>
</div>

I believe Ace is using Fuel UX 2. You can view the docs here . 我相信Ace正在使用Fuel UX2。您可以在此处查看文档

I'm not familiar with ASP .net, but am familiar with Fuel UX Wizard. 我不熟悉ASP .net,但熟悉Fuel UX向导。 You will need to trigger "code behind" or the server side code from within a JavaScript event. 您将需要在JavaScript事件中触发“后台代码”或服务器端代码。 There is a wizard change event that will trigger when the next or previous buttons are clicked. 单击下一个或上一个按钮时,将触发一个向导change事件。 However if you are going to reload the page (which believe is how postbacks work). 但是,如果您要重新加载页面(这是回发是如何工作的)。 You will need to store and re-inititialize the wizard with the step you are wanting to show. 您将需要使用要显示的步骤来存储并重新初始化向导。 Fuel UX was designed primarily for "single page apps" or web applications that don't reload pages. Fuel UX主要设计用于“单页应用程序”或不重新加载页面的Web应用程序。

You might look at something like this Make a service reference in an asp:ScriptManage 您可能会看到这样的内容在asp:ScriptManage中创建服务引用

If you're trying to customize the previous and next actions of your wizard, I had to do the same thing recently. 如果您要自定义向导的上一个操作和下一个操作,最近我必须做同样的事情。 If you add a hidden field at the beginning of your wizard like so: 如果您在向导的开头添加一个隐藏字段,如下所示:

Its possible to create custom js functions that control the movement of the wizard better than the default ones given by Fuelux. 与Fuelux提供的默认功能相比,可以创建自定义js函数来更好地控制向导的移动。 What I did was a GoNext(index) and GoPrev(index) that did two things: 我所做的是执行两个操作的GoNext(index)和GoPrev(index):

  1. Changed the selected item of the wizard. 更改了向导的所选项目。 Look into 调查

$('#myWizard').wizard('selectedItem', { step: NewIndex}); $('#myWizard')。wizard('selectedItem',{步骤:NewIndex});

  1. Updated the hidden field to save the tab you're on through postbacks. 更新了隐藏字段,以保存您通过回发使用的选项卡。 document.getElementById('<%=stepState.ClientID%>').value = NewIndex; document.getElementById('<%= stepState.ClientID%>')。value = NewIndex;

Inside of each tab you would just have to call the appropriate function with the index value being that of the next tab, and you can place these function calls inside of regular ASP:Buttons as an OnClientClick. 在每个选项卡内部,您只需调用索引值为下一个选项卡的索引的适当函数,即可将这些函数调用作为OnClientClick放置在常规ASP:Buttons中。

Hope it helps. 希望能帮助到你。

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM