views:

355

answers:

0

I'm iterating through a collection on my view model. The collection contains HealthLifeDentalRates which implement IBeginsEnds. I have a Display Template BeginsEnds that displays the date range. This results in very slow performance. If I simply the date range (see commented code), it's fine. I think how I'm defining the lambda is the problem but not sure how to change it.

<% foreach (var item in Model.Data.OrderBy(x=>x.HealthLifeDentalRateCode))
{ %>

    <tr>
        <td>
            <%= Html.Encode(item.FiscalPeriodString()) %>
        </td>
        <td>
            <%= Html.Encode(item.HealthLifeDentalRateCode) %>
        </td>
        <td>
            <%= Html.Encode(item.Rate) %>
        </td>
        <td>
            <%= Html.Encode(item.IsDental.YesNo()) %>
        </td>
        <td>
            <%= Html.DisplayFor(i => item, "BeginsEnds") %>
            <!-- <%= Html.Encode(item.Begins.ToDateString()) %> - <%= Html.Encode(item.Ends.ToDateString()) %> -->
        </td>
        <td>
            <%= Html.Encode(String.Format("{0:g}", item.Loaded)) %>  - <%= Html.Encode(item.LoadedBy) %>
        </td>
    </tr>

<% } %>