ASP .NET MVC 3 - Passing Parameters from View to Controller?

You could use the following overload: @Html. ActionLink( "link text", // linkText "Index", // actionName "MyController", // controllerName new RouteValueDictionary { // routeData { "MyItem. Name", "example" } }, null // htmlAttributes ).

Nice idea but doesn't work I'm afraid. – Pete Oakey Oct 10 at 21:53.

Have you tried: @Html. ActionLink("Index", "MyController", new { name = @Model.MyItem. Name }) And in the action method: public ActionResult Index(string name) { return View(); }.

I know I can do it that way but I thought the default model binder could handle inheritance so all I would have to have as a parameter is my view model object. – Pete Oakey Oct 10 at 21:39.

I think you may be misunderstanding 'the passing of object from view to controller'. It's not that you're passing object - you're just rendering a link (anchor tag) in the page. The request will actually come from the browser when the user clicks the link.

There is no 'server-side object passing' going on. The link has to contain all the parameters you need on the server side (in controller) as query string parameters. I think that what you really want to do is either: render a form and submit it, or pass only the id of the data you need and in the controller retrieve it (from DB for example).

I cant really gove you an answer,but what I can give you is a way to a solution, that is you have to find the anglde that you relate to or peaks your interest. A good paper is one that people get drawn into because it reaches them ln some way.As for me WW11 to me, I think of the holocaust and the effect it had on the survivors, their families and those who stood by and did nothing until it was too late.

Related Questions