Click here to Skip to main content
15,886,919 members
Please Sign up or sign in to vote.
0.00/5 (No votes)
See more:
I'm creating editorfor within a loop in my view

HTML
@for (int i = 0; i < laguages.Count; i++)
{
@Html.EditorFor(m=> model.Name, null, new { id = "id", name = "na" })
}


When I'm going to read this editorfors' values from the controller it always show the control name as the Name within the FormCollection.
Here's my controller method

C#
[HttpPost]
public ActionResult Create(FormCollection form)
{
}


What I have tried:

@Html.EditorFor(m=> model.Name, null, new { id = "id", name = "na" })
Posted
Comments
F-ES Sitecore 12-Dec-16 6:19am    
Leave the name as it is, that's how MVC binds the model with the html control.

This content, along with any associated source code and files, is licensed under The Code Project Open License (CPOL)



CodeProject, 20 Bay Street, 11th Floor Toronto, Ontario, Canada M5J 2N8 +1 (416) 849-8900