tags:

views:

35

answers:

1

Who does any one makes multiline grid in Mvc? How can i to do that? Please help me.

Thanks

Vicky

A: 

Here's how you would do it generically (remember no grid views in MVC!)

<% if (Model != null && Model.Count() > 0) %>
    <% { %>
        <table>
            <tr>
                <th>
                    Object property 1 name
                </th>
                <th>
                    Object property 2 name..
                </th>
            </tr>

        <% int i = 0; foreach (var item in Model) %>
        <% { %>

            <tr class="<%= i++ % 2 == 0 ? "cssPrimaryGridRow" : "cssAltGridRow" %>">

                <td>
                    <%= Html.Encode(item.Property1)%>
                </td>
                <td>
                    <%= Html.Encode(item.Property2)%>
                </td>
            </tr>

        <% } %>

        </table>

    <% } %>
RailRhoad