试图在MVC4(+ Razor)中实现表单,但提交按钮没有做任何事情。MVC 4表单 - 提交按钮不起任何作用
控制器(应该得到这个职位,动作):
public class GeneralController
{
[HttpPost]
public ActionResult SearchResults(SearchParamsModel searchParams)
{
// doin some stuff here
return View("SearchResultsView");
}
}
视图(.cshtml)
@model Models.SearchParamsModel
@using (Html.BeginForm("SearchResults", "General", FormMethod.Post))
{
<section class="form-field">
<input type="text" name="Property1" id="Property1" class="field field139 autocomplete-init-no-img" />
<label for="Property1">value1</label>
<form action="" method="post" class="clearfix">
<input type="submit" value="some value" class="submit btn blue-btn special-submit" />
</form>
</section>
}
型号
public class SearchParamsModel
{
public string Property1{ get; set; }
}
[不创建嵌套表格...](HTTP ://stackoverflow.com/questions/379610/can-you-nest-html-forms) –
只是帮助我!谢谢! –