c# - Model Properties passing as nulls to Action -


I'm trying to pass an item with "employee document" in my action, but tap back all values And I am not sure why I have tried to cross the whole model along with just the pieces and all of them are empty and I am not sure why this is happening.

Here's how my view looks:

   Item Title) & lt; / Td> & Lt; TD & gt; @html Displayer (model istam => item type) & lt; / Td> & Lt; TD & gt; @html DisplayFlier (model istam => item created) & lt; / Td> & Lt; TD & gt; @html Displayer (Model Itam => Items. Preserved Date) & lt; / Td> & Lt; Td> & Lt; A href = "@ item.FullUrl" & gt; View & lt; / A & gt; | @ Html.ActionLink ("Change", "Change Employee Employee", "Employee", New {title = item.Title, doctype = item.DocumentType, Created Item = Item. Created Date, Created = Item. , Full URL = item.FULLURL}). @html ActionNlink ("Delete", "Delete Emporium Document", New {fileName = item.FullUrl, Employee No = Item. Empire}}  & lt; / TR & gt;} & lt; / tbody >  

I am focusing on the replacement action link in the table.

This is how my work looks like: < / P>

  [HttpGet] Public Functional Replacement Emporary Document (String Title, String Cocktip, Datetime Bidet, String B Remove, string full url) {var doc = new EmployeeDocument (); return partial view (doctor);}  

All parameters in the operation are zero.Is there something like this that

You are trying to post back the collection of objects, to work for it You need to use the loop and use the properties of hidden inputs as follows:

  @using (Html.BeginForm ("ReplaceEmployeeDocument", "Controller")) {@for (var i = 0; I & lt; Model.count (); I ++) {& lt; Tr & gt; & Lt; TD & gt; @ Html.HiddenFor (m = & gt; m [i] .title) @html. DisplayFor (M => M [I]. Title) & lt; / Td> & Lt; TD & gt; @ Html.HiddenFor (m = & gt; m [i] .documentationType) @html. DisplayFor (M => M [i] .DocumentationType) & lt; / Td> & Lt; TD & gt; @ Html.HiddenFor (m => m [i]. Crated b) @html. DisplayFor (M => M [i]. Crated By) & lt; / Td> & Lt; TD & gt; @ Html.HiddenFor (m = & gt; m [i] .redited) @html. DisplayFor (M => M [I]. CreditedDet)  & Lt; Td> & Lt; A href = "@ item.FullUrl" & gt; View & lt; / A & gt; | & Lt; Input type = "submit" value = "change" /> & Lt; / Td> & Lt; / TR & gt; }}  

You also need a similar post method which accepts the model going back:

  [http post] Change public action Employee employee document (employee document model) {var doctor = new employee document (); Return partial view (doctor); }  

Comments