I have an edit application view, and it can be found at the following URL:
http://localhost:17262/Application/EditApplication/1
1 equals the application ID.
Also on the page I have a link that goes to another view to add an assistant for the application. I want to pass it the application ID so that the new assistant can be “linked” to this application. How would I get the value of 1 and add it to my action link? This is what I have in my HTML so far:
<%: Html.ActionLink("Add New Assistant", "Create", "Assistant", new { applicationID = "id" }, null) %>
Please could someone advise?
Thanks
If you use the default routing settings
should do what you want.
you can also pass the id from the controller to the view using the ViewData
and use it in your view
or in a strongly typed view use the viewmodel to pass the id: