如何将TextBox的值作为ActionLink的参数发送?
我需要使用Html.TextBoxFor
<%= Html.TextBoxFor(m => m.SomeField)%>
<%= Ajax.ActionLink("Link Text", "MyAction", "MyController", new { foo = "I need here the content of the textBox, I mean the 'SomeField' value"}, new AjaxOptions{ UpdateTargetId = "updateTargetId"} )%>
Run Code Online (Sandbox Code Playgroud)
Contoller/Actions看起来像这样:
public class MyController{
public ActionResult MyAction(string foo)
{
/* return your content */
}
}
Run Code Online (Sandbox Code Playgroud)
使用MVC 2.0