默认是get提交,如果是post提交需要在控制器ActionResult上加:[AcceptVerbs(HttpVerbs.Post)]
举例:
class="p0">在HelpController中,会定义如下的Action:
[AcceptVerbs(HttpVerbs.Post)]
public ActionResult Search() {
string searchTit = Request["searchTit"];
return RedirectToAction("Index");
}
在View中,如下:
<div>
@using(Html.BeginForm("Search","Help")){
<input id="searchTit" name="searchTit" type="text" placeholder="请输入要填写的内容" class="input_text_help" />
<div>
<input type="submit" id="submit" name="submit" value="submit" />
</div>
}
</div>