c# - Html.ActionLink passes null value -
c# - Html.ActionLink passes null value -
i have view displays list of objects. there have action link
@html.actionlink("add", "add", new {str = model.first().directory})
and method in controller.
public actionresult add(string parentdirectory) { userservice.node file = new userservice.node() { parent_directory = parentdirectory, }; homecoming view(file); }
for reason unknown me parentdirectory
null, when tried this
@html.actionlink("add", "add", new {str = "hello"})
how can prepare ?
since parameter name of add
controller action method parentdirectory
, need alter this
@html.actionlink("add", "add", new { str = model.first().directory })
to this
@html.actionlink("add", "add", new { parentdirectory = model.first().directory })
c# asp.net-mvc
Comments
Post a Comment