I'm having a problem passing parameters from my view to my popup.
In my view, I have the following razor code to render an Action Link wherein when I click it, a pop-up will appear:
@Html.ActionLink("[Edit Product]", "Edit", "Products", new { ProductCode = @Model.ProductCode}, new { @class = "editLink" })
I'm not quite sure if this is correct or if the part new { ProductCode = @Model.ProductCode}
makes any sense (please explain to me what that part does, anybody hihi).
Anyway, my pop-up code accepts a parameter like this:
@model MySuperStore.Models.ViewModel.ProductsModel
Whenever I try to display the ProductCode via @Mode.ProductCode
, I always receive an error saying the reference not set to an instance of an object.
I have tried placing the ProductCode in a ViewData
through the MainView and accessing it on the pop-up but that doesn't seem to work either.
Can somebody please help me? Thanks. Cheers!