我使用MVC部分视图。我有两个Page AddPoll.cshtml和Listpoll.cshtml。页面AddPoll.cshtml使用部分视图。 我使用AddPoll:部分视图页面放置了Listpoll的部分视图。
@Html.Partial("/Areas/admin/Views/Poll/AddPoll.cshtml",new Mvc_baker.Areas.admin.Models.pollquestion());
AddPoll.cshtml
@model Mvc_baker.Areas.admin.Models.pollquestion
<link href="~/Content/bootstrapvalidform.css" rel="stylesheet" />
@using (Html.BeginForm(actionName: "AddPoll", controllerName: "Poll"))
{
@Html.ValidationSummary(true, "", new { @class = "text-danger" })
<form class="">
<div class="col-md-6">
<div class="panel panel-primary">
<label class="control-label">پرسش</label>
@Html.TextBoxFor(m => m.QuestionText, new { id = "Name",style="width:450px", @class = "form-control" })
@Html.ValidationMessageFor(m => m.QuestionText)
<input class="btn btn-primary btn-default" name="commit" value="register" type="submit">
</div>
</div>
</form>
}
单击注册按钮时,控制操作不适用
当控制断点操作时我无法运行
答案 0 :(得分:0)
您似乎有2个嵌套的html表单,这是无效的标记。 Html.BeginForm
帮助程序已生成<form>
标记。所以你应该摆脱内在的形式。
@model Mvc_baker.Areas.admin.Models.pollquestion
<link href="~/Content/bootstrapvalidform.css" rel="stylesheet" />
@using (Html.BeginForm(actionName: "AddPoll", controllerName: "Poll"))
{
@Html.ValidationSummary(true, "", new { @class = "text-danger" })
<div class="col-md-6">
<div class="panel panel-primary">
<label class="control-label">پرسش</label>
@Html.TextBoxFor(m => m.QuestionText, new { id = "Name",style="width:450px", @class = "form-control" })
@Html.ValidationMessageFor(m => m.QuestionText)
<input class="btn btn-primary btn-default" name="commit" value="register" type="submit" />
</div>
</div>
}