Nopcommerce 渲染 Bootstrap 选项卡标题提交

Nop Commerce RenderBootstrapTabHeader Submit

我在 NopCommerce v3.8 的自定义插件中有以下代码。

@using Nop.Web.Framework;
@using Nop.Core;
@using System.Linq;
@using Nop.Web.Framework.UI;
@using Nop.Web.Framework;
@using Nop.Core.Infrastructure;
@model Nop.Plugin.Widgets.PromoSlider.Domain.PromoSliderRecord

@{ Layout = "_AdminLayout.cshtml"; }

<div class="content">
<div class="form-horizontal">
    <div id="slider-edit" class="nav-tabs-custom">
        <ul class="nav nav-tabs">
            @Html.RenderBootstrapTabHeader("Slider", @T("Slider"), true)
            @Html.RenderBootstrapTabHeader("Images", @T("Images"))
        </ul>
        <div class="tab-content">
            @Html.RenderBootstrapTabContent("Slider", Sliders(), true)
            @Html.RenderBootstrapTabContent("Images", Images(), false)
        </div>
    </div>
</div>
</div>


@helper Sliders()
{
using (Html.BeginForm())
{
    @Html.AntiForgeryToken()

    <div class="panel-group">
        <div class="panel panel-default">
            <div class="panel-body">
                <div>
                    <div class="adminData">@Html.HiddenFor(m => m.PromoSliderId)</div>
                </div>
                <div class="form-group">
                    <div class="col-md-2">@Html.NopLabelFor(m => m.PromoSliderName)</div>
                    <div class="col-md-9">
                        @Html.EditorFor(m => m.PromoSliderName)
                        @Html.ValidationMessageFor(m => m.PromoSliderName)
                    </div>
                </div>
                <div class="form-group">
                    <div class="col-md-2">@Html.NopLabelFor(m => m.IsActive)    </div>
                    <div class="col-md-9">
                        @Html.EditorFor(m => m.IsActive)
                        @Html.ValidationMessageFor(m => m.IsActive)
                    </div>
                </div>
                <div class="form-group">
                    <div class="col-md-2">@Html.NopLabelFor(m => m.Interval)</div>
                    <div class="col-md-9">
                        @Html.EditorFor(m => m.Interval)
                        @Html.ValidationMessageFor(m => m.Interval)
                    </div>
                </div>
                <div class="form-group">
                    <div class="col-md-2">@Html.NopLabelFor(m => m.Wrap)</div>
                    <div class="col-md-9">
                        @Html.EditorFor(m => m.Wrap)
                        @Html.ValidationMessageFor(m => m.Wrap)
                    </div>
                </div>
                <div class="form-group">
                    <div class="col-md-2">@Html.NopLabelFor(m => m.PauseOnHover)</div>
                    <div class="col-md-9">
                        @Html.EditorFor(m => m.PauseOnHover)
                        @Html.ValidationMessageFor(m => m.PauseOnHover)
                    </div>
                </div>
                <div class="form-group">
                    <div class="col-md-2">@Html.NopLabelFor(m => m.ZoneName)</div>
                    <div class="col-md-9">
                        @Html.DropDownListFor(m => m.ZoneName, new SelectList(
                    new List<string>() {
                        "producdivetails_top",
                        "categorydetails_after_breadcrumb",
                        "home_page_top"
                    }))
                        @Html.ValidationMessageFor(m => m.ZoneName)
                    </div>

                </div>
                <div class="pull-right">
                    <button type="submit" name="save" class="btn bg-blue">
                        <i class="fa fa-floppy-o"></i>
                        @T("DERP")
                    </button>
                </div>
            </div>
        </div>
    </div>                     
}

}

@helper Images()
{
if (Model.PromoSliderId > 0)
{
    @Html.Action("ManagePromoImages", new { PromoSliderId = Model.PromoSliderId })
}
else
{
    <p>Please create and save a slider first.</p>
}

}

提交按钮根本没有触发,原因可以通过查看生成的源找到。

<div class="content">
<div class="form-horizontal">
    <div id="slider-edit" class="nav-tabs-custom">
        <ul class="nav nav-tabs">
            <li class="active"><a data-tab-name="Slider" data-toggle="tab" href="#Slider">slider</a></li>
            <li class=""><a data-tab-name="Images" data-toggle="tab" href="#Images">images</a></li>
        </ul>
        <div class="tab-content">
            <form action="/PromoSlider/CreateUpdatePromoSlider" method="post"></form><div class="tab-pane active" id="Slider"><input name="__RequestVerificationToken" type="hidden" value="uH2GbG4t6n0dDyBs79d6GQZTorBRpgWFCFithR77gSkAUYvPkMecNIwYtkEGyayid97gmdQp-isUUkMq1M7qSpeYOzwLGW-9WtUIxggkBd-0gATnIt5CvfEtUpjqwnl90" />        <div class="panel-group">
        <div class="panel panel-default">
            <div class="panel-body">
                <div>....

正如您看到的,由于某些疯狂的原因,它决定创建表单,然后关闭它并在表单后输入所有@helper html 代码,包括提交按钮。

我的问题,你还能用吗

@Html.BeginForm

里面

@Html.RenderBootstrapTabHeader

真的很想让它在 3.8 中运行,谢谢。

我现在可以提供的唯一方法是使用带有所需参数的 <form></form> 标签在 @helper {} 中创建一个表单。 我们创建了一个适当的问题来调查这个问题: https://github.com/nopSolutions/nopCommerce/issues/1840