0

Estoy trabajando com mvc, pero al mostrar una tabla me aparece asi https://gyazo.com/31ced13cc743e7afd08d3132cd037522

Esta es mi view

<table class="table">
<tr>
    @for (int i = 0; i < Methods.CurrentTable.GetColumns().Count(); i++)
    {

        <th>
        @Html.DisplayTextFor(item => Methods.CurrentTable.GetColumns()[i].ColumnName)    
        </th>
     }
</tr>   
<tr> 
   @for (int i = 0; i < Methods.Rows.Count(); i++)
   {
       for (int m = 0; m < Methods.Rows[i].Registers.Count(); m++)
       {
           if (Methods.Rows[i].Registers[m] != "")
           {
            <td>
                @Html.DisplayTextFor(x => Methods.Rows[i].Registers[m])<br />

            </td>
           }
       }
   }
    </tr>
</table>

1 respuesta 1

1

Tienes que colocar el <tr> dentro del primer for asi:

<table class="table">
<tr>
    @for (int i = 0; i < Methods.CurrentTable.GetColumns().Count(); i++)
    {

        <th>
        @Html.DisplayTextFor(item => Methods.CurrentTable.GetColumns()[i].ColumnName)    
        </th>
     }
</tr>   

   @for (int i = 0; i < Methods.Rows.Count(); i++)
   {
       <tr>
       for (int m = 0; m < Methods.Rows[i].Registers.Count(); m++)
       {
           if (Methods.Rows[i].Registers[m] != "")
           {
            <td>
                @Html.DisplayTextFor(x => Methods.Rows[i].Registers[m])<br />

            </td>
           }
       }
       </tr>
   }

</table>
1
  • No me habia dado cuenta, muchas gracias, perdon por la molestia.
    – Luis Ortiz
    el 3 ago. 2018 a las 22:05

Tu Respuesta

By clicking “Publica tu respuesta”, you agree to our terms of service and acknowledge you have read our privacy policy.

¿No es la respuesta que buscas? Examina otras preguntas con la etiqueta o formula tu propia pregunta.