【问题标题】:Partial View Submit Button Not Working部分视图提交按钮不起作用
【发布时间】:2015-02-16 00:58:45
【问题描述】:

我的问题是,提交按钮不起作用。如您所见,我的局部视图包含一个 jquery 模式。如果您单击“mdlist”,模态将与提交按钮一起出现。

你能告诉我可能的问题吗?

@model IEnumerable<MyApp.Models.Participant>
<link type="text/css" rel="stylesheet" href="http://code.jquery.com/ui/1.11.3/themes/smoothness/jquery-ui.css">
<script type="text/javascript" src="http://code.jquery.com/jquery-1.10.2.js"></script>
<script type="text/javascript" src="http://code.jquery.com/ui/1.11.3/jquery-ui.js"></script>

<a id="mdlist" class="button" href="#"><span class="new icon"></span>Add Participant</a>
<div id="dialog" class="content-wrapper">
    <div class="buttons">
    <input type="submit" name="submitButton" value="Save" class="button save icon" />
    </div>
    <table cellspacing="0">
        <thead>
            <tr>
                <th>

                </th>
                <th>
                    @Html.DisplayNameFor(model => model.Name)
                </th>
            </tr>
        </thead>

@foreach (var item in Model)
{
   <tbody>
     <tr>
        <td>
            <input type="checkbox" name="ParticipantCheck" id="@item.ID" />
        </td>
        <td>
            @Html.DisplayFor(modelItem => item.Name)
        </td>
    </tr>
   </tbody>
}
</table>
</div>
                <script type="text/javascript">
                $(function () {
                    $("#dialog").dialog({
                        autoOpen: false,
                        height: 400,
                        width: 670,
                        modal: true,
                        closeOnEscape: true,
                        resizeable: false
                    });
            </script>

【问题讨论】:

    标签: c# asp.net-mvc model asp.net-mvc-partialview


    【解决方案1】:

    首先你需要通过

    添加Form(提交按钮只有在有表单时才有效)
    @using(@Html.BeginForm()){ 
    //place your html elements and submit button here 
    }
    

    接下来,如果您有一个数组,您添加 checkboxes 的方式不正确,请查看 this 链接

    【讨论】:

      猜你喜欢
      • 2014-10-20
      • 2013-04-09
      • 1970-01-01
      • 1970-01-01
      • 2015-06-24
      • 1970-01-01
      相关资源
      最近更新 更多