I am new in asp.net mvc and learning. I have a view which pass a value to my method. This is the code below for passing that value:
@Html.ActionLink("CPD Details", "Details1", new { id=item.ID, item.LastName})
Below is the method for my Details1. Some of the code has been omitted.
public ActionResult Details1(int id, string LastName)
return View()
Below is part of my Details1 view:
@model IEnumerable<onlineCPD.Models.cpd_certificates>
Please not that the value is coming from another model and there are independent i.e no mapping or relationship set. How do I display this passed value in my Details1 view?
If you just want to view those variables in your view you should use ViewBag. Read this webpage for more information about ViewBag – ViewBag in MVC 3
Controller
Your Details1 View
Go through this tutorial to learn more. MVC-Music-Store Tutorial