I am generating multi Data entry Line using ASP MVC , however looking at the HTML source after generating by MVC, I've just noticed those HTML elements has a duplicated ID , even with the same html type it is look something wrong ? is that normal behavior in MVC and how to avoid it ? , I need really to have it unique, assuming MVC should handle the ID generation for multi line, which is additional concern to me . My code :
@foreach (var item in Model.lstMeals)
{
<tr>
<td>
<input asp-for="@item.cuisine.CuisineName" />
@Html.DisplayFor(modelItem => item.cuisine.CuisineName)
</td>
</tr>
}
then looking in HTML Source :
<tr>
<td>
<input type="text" id="item_cuisine_CuisineName" name="item.cuisine.CuisineName" value="Italian" />
Italian
</td>
</tr>
<tr>
<td>
<input type="text" id="item_cuisine_CuisineName" name="item.cuisine.CuisineName" value="French" />
French
</td>
</tr>
<tr>
<td>
<input type="text" id="item_cuisine_CuisineName" name="item.cuisine.CuisineName" value="Greek" />
Greek
</td>
</tr>