I have problem with ActionLink. I'd like to pass to my ActionLink parameter for my MessageController, for Edit action: to generate somthing like this /MessagesController/Edit/4
So I have ListView control with binding expression:
and how to pass this ID to ActionLink as parameter to my Controller Edit action? This doesn't work: , null) %>In MVC you are not supposed to databind from the view in the way that you have. The data that you want to pass to the ActionLink method needs to be added to ViewData in your controller. Then in the view you retrieve it from ViewData:
<%= Html.ActionLink("My Edit Link", "Edit", "Message", new { id = ViewData["id"] }) %>
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With