【问题标题】:MVC Razor Using FormMVC Razor 使用表单
【发布时间】:2015-05-13 08:36:45
【问题描述】:

我的视图中有一个类似的表单,但是如何在我的表单中进行选择,因为我找不到任何SelectFor。

这个表单在一个模态对话框中,即正文。所以它是按钮,但我在模式页脚中有“取消”和“确定”按钮。那么如何从这个表单中删除提交按钮,并将其放在模态框的页脚中?

谢谢

@using (Html.BeginForm("LeggTilUtdannelse", "Utdannelse", FormMethod.Post, new { @class = "form-horizontal" }))
            {
                @Html.AntiForgeryToken()

                <div class="form-group">
                    @Html.LabelFor(m => m.Studiested, new { @class = "col-md-2 control-label" })
                    <div class="col-md-10">
                        @Html.TextBoxFor(m => m.Studiested, new { @class = "form-control", autocomplete = "off" })
                    </div>
                    @Html.ValidationMessageFor(m => m.Studiested)
                </div>

                <div class="form-group">
                    @Html.LabelFor(m => m.Beskrivelse, new { @class = "col-md-2 control-label" })
                    <div class="col-md-10">
                        @Html.TextBoxFor(m => m.Beskrivelse, new { @class = "form-control", autocomplete = "off" })
                    </div>
                </div>

                <div class="form-group">
                    @Html.LabelFor(m => m.Fra, new { @class = "col-md-2 control-label" })
                    <div class="col-md-10">
                        @Html.TextBoxFor(m => m.Fra, new { @class = "form-control", autocomplete = "off" })
                    </div>
                </div>

                <div class="form-group">
                    @Html.LabelFor(m => m.Til, new { @class = "col-md-2 control-label" })
                    <div class="col-md-10">
                        @Html.TextBoxFor(m => m.Til, new { @class = "form-control", autocomplete = "off" })
                    </div>
                </div>

                <div class="form-group">
                    <div class="col-md-offset-2 col-md-10">
                        <input type="submit" class="btn btn-default" value="Legg til" />
                    </div>
                </div>

【问题讨论】:

标签: asp.net-mvc razor


【解决方案1】:

最简单的方法是将您的模态转换为一个表单,即,而不是这样:&lt;div class="modal fade"&gt; 这样做:form class="modal fade" action="/Utdannelse/LeggTilUtdannelse" method="POST">。

【讨论】:

    猜你喜欢
    • 2014-06-14
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    • 2011-09-19
    • 1970-01-01
    • 1970-01-01
    • 2019-06-22
    • 2020-09-14
    相关资源
    最近更新 更多