我有一个显示模型的cshtml:
<div>
<h3>@WebMVCStrings.Title</h3>
<span>@Html.DisplayFor(model => model.Title.Value)</span>
</div>
<div class="lead-summary__text">
<h3>@WebMVCStrings.Name</h3>
<span>@Html.DisplayFor(model => model.Name)</span>
</div>
<div class="lead-summary__text">
<h3>@WebMVCStrings.Surname</h3>
<span>@Html.DisplayFor(model => model.Surname)</span>
</div>
然后我有两个按钮,应该在不同的控制器中执行不同的操作。我的按钮如下:
<div>
<button id="createC">
<i class="icon-arrow-left"></i> Back
</button>
<button id="createL">
Submit
</button>
</div>
而且两个按钮都有javascript:
<script>
$("#createL").on("click", function (e) {
window.location = "@Url.Action("CreateL", "LedController")&clientCode=@Model.ClientCode&ledId=0";
});
$("#createC").on("click", function (e) {
window.location = "@Url.Action("CreateC", "ClientController", Model)";
});
</script>
但是,当我单击应该在ClientController中执行CreateC操作的后退按钮时,它没有被击中。
我的操作CreateC如下:
[HttpPost]
[ValidateAntiForgeryToken]
public ActionResult CreateC(ClientViewModel clientViewModel)
{*some actions*}
关于如何执行此操作的任何想法?谢谢