I’m working on the following:
1- The user enters a value inside a textBox.
2- then clicks edit to go to the edit view.
This is my code:
<%= Html.TextBox("Name") %>
<%: Html.ActionLink("Edit", "Edit")%>
The problem is I can’t figure out how to take the value from the textBox and pass it to the ActionLink, can you help me?
You can’t unless you use javascript. A better way to achieve this would be to use a form instead of an
ActionLink:which will automatically send the value entered by the user in the textbox to the controller action:
And if you wanted to use an ActionLink here’s how you could setup a javascript function which will send the value:
and then: