I have a form in MVC:
<% using (Html.BeginForm("Get", "Person"))
{ %>
<%= Html.TextBox("person_id")%>
<input type="submit" value="Get Person" />
<% } %>
This redirects me to Person/Get. Okay. The question:
How do I make this Form so it redirects me to Person/Get/{person_id}?
Edit:
<% using (Html.BeginForm("Get", "Person", new { id = ??? }))
{ %>
<%= Html.TextBox("person_id")%>
<input type="submit" value="Get Person" />
<% } %>
What do I write in ???
I think the most difficult way would be using a javascript clientside.
The more straightforward way is to retrieve it on the action
Person/Getand from there return a RedirectResult pointing toPerson/Get/{person_id}The redirect is usually so fast that the user will never notice. He/she will arrive at /Person/Get/{person_id}