MVC4 Html.BeginForm在Internet Explorer中提交按钮> 9不工

2019-10-20 06:32发布

我已经写在ASP.NET MVC4 /剃刀的形式。 该表格后很完善在Firefox和Chrome,但由于某种原因在Internet Explorer 10和11,“提交”按钮没有反应。 (Internet Explorer 9的作品也不错)。

这是我的看法形式的样子:

<div class="bla">
    <table style="width:100%;">
    @using (Html.BeginForm("MyAction","MyController", FormMethod.Post, new        {id="myID"}))
    {
       <thead>
            <tr>
                <th class="heading highlight">Enter Registration</th>
                <th>
                    <span style="display: block;">
                        @Html.EditorFor(model => model.Sign)
                        <input style="margin-left:4px;" type="submit" value="Save" />
                    </span>
                    <span style="display: block; font-weight: normal;">@(Model.SignDescription)</span>

                </th>
            </tr>
        </thead>
    }
    </table>
</div>

这是我的控制器:

[HttpPost]
public ActionResult MyAction(InfoModel infoModel)
{
     if(!string.IsNullOrEmpty(infoModel.Sign))
     {
            //do something
     }

     infoModel = LoadModel ();

     return (indoModel);
}

我真的不知道为什么会这样?

提前致谢!

编辑:我的形式是一个表里面,我忘了补充它..

Answer 1:

您的标记是无效的 - 表单元素不能是表元素的子。 重新排列您的标记,以便@using (Html.BeginForm(将里面<th>



Answer 2:

你不需要写“myController的”完整的尝试前缀只是形式上的写作。



Answer 3:

此外,还要确保您的用户尚未禁用JavaScript的。 我花了最后2天试图找出为什么这个没有对IE8的工作,但在其他浏览器的罚款。 我甚至不得不构建Windows XP安装Hyper-V,只是为了尝试和重现的问题!



文章来源: MVC4 Html.BeginForm submit button in internet Explorer >9 not working