I have foreach loop with razor engine like this
@foreach (var item in Model.Item3.Matriz.Select((value, i) => new { i, value })) {
<tr>
<td>@item.value.Unidad</td>
<td class="hidden">@Html.Hidden("Item3.Matriz[" + item.i + "].Unidad", item.value.Unidad, new { @id = "Unidad_" + item.i })</td>
</tr>
}
So in table I can receive into Unidad
value only values CORP
, ALU
AND PLA
I want to know if it´s possible to replace that values with anothers.
For example:
If I receive CORP
from backend change it in front for CORPORATION
Is that possible?
Just use the string function Replace() to replace the value of Unidad like what I have done in the modification of your code sample below.
@foreach (var item in Model.Item3.Matriz.Select((value, i) => new { i, value })) {
<tr>
<td>@item.value.Unidad.ToString().Replace("CORP", "CORPORATION")</td>
<td class="hidden">@Html.Hidden("Item3.Matriz[" + item.i + "].Unidad", item.value.Unidad, new { @id = "Unidad_" + item.i })</td>
</tr>
}