我在视图中有一个FormMethod.Get表单:
@using (Html.BeginForm("Search", "Pages", new { filter = "Properties" }, FormMethod.Get))
提交时此表单将所有输入作为查询字符串发送,即使输入具有空值,如:
http://localhost:1156/Pages/Search?q=anything&id=&t=
我想阻止发送带有空值的输入,所以url是这样的:
http://localhost:1156/Pages/Search?q=anything