我需要 ASP MVC 方面的帮助。我有:
<% using (Html.BeginForm(null,null,FormMethod.Post)) {%>
<p>
<input type="submit" value="Choose" />
.
.
.
<%=Html.ActionLink("Save", "Index")%>
</p>
<% } %>
而且我需要通过该 ActionLink 提交表单,因为我需要从下拉列表中获取 selectedValue 并且我不知道如何从 FormCollection 或具有属性 POST 的方法中的参数中执行此操作。
所以我需要在点击操作链接后调用这个函数。
[AcceptVerbs(HttpVerbs.Post)]
public ActionResult Index(FormCollection formValues)
{
}
我用 jquery 尝试了一些东西,Ajax.ActionLink
但一切都称为 Index 的 GET 方法。(new { onclick = "$(this).parents('form').first().submit();"
- 对我不起作用 - 它也称为 GET 方法)