I have the following view that is responsible for showing the code in this format 9-9-99. And from the controller I indicate that it is ordered by the code, which is stored in full:
<table id="listado_table " class="table table-striped table-bordered dt-responsive" cellspacing="0" width="100%">
<thead>
<tr style="background-color:#ff6a00;color:#fff">
<th>Codigo</th>
<th>Nombre</th>
<th>Acciones</th>
</tr>
</thead>
<tbody>
<% foreach (var item in Model.listado)
{ %>
<tr>
<td>
<div style="display:none"> <%: item.codigo%></div>
<%:
(String.Format("{0:#-#-##}", item.codigo)) %> // aquí le colocó String.Format, y se pierde el orden
</td>
<td>
<%:item.nombre %>
</td>
<td class="center-block">
acciones
</td>
</tr>
<% } %>
</tbody>
</table>
But when I put it to ítem.codigo (String.Format ("{0: # - # - ##}", item.codigo)), it causes the whole order to be lost item.codigo, but when not it has (String.Format ("{0: # - # - ##}", item.codigo)), it is ordered. I would like to know if there is any way to order it in that format 9-9-99, without losing the order by code
In that order you should show me when with that format (I put it inside the red rectangle)
But he shows it to me like this:
But when I remove the String.Format, I can verify that they are ordered by code.
The problem is that it messes up when I put String.Format