3

How can I pass a textbox's value to the controller's action when I do a ActionLink?

I found the following example which passed "static" string (Veggie Sandwiches) to the action (binded to dishName). I need something similar but instead I want to pass the value from a textbox on to the view.

@Ajax.ActionLink(
"Where are my Sandwiches??????",
"GetSandwiches",
new {
    dishName = "Veggie Sandwiches"},
new AjaxOptions
{
    HttpMethod = "POST",
    InsertionMode = InsertionMode.Replace,
    UpdateTargetId = "SandwichStation"
}
)
kroiz
  • 1,722
  • 1
  • 27
  • 43
  • Have you seen this post: http://stackoverflow.com/questions/6699301/passing-parameters-to-mvc-ajax-actionlink ? – David Tansey Aug 11 '13 at 05:00
  • Well, no. is it still relevant for MVC 4? and Razor? I will have to understand the two suggested solutions there... – kroiz Aug 11 '13 at 06:13

0 Answers0