开发者

Slow performance with MVC2 DisplayFor

开发者 https://www.devze.com 2022-12-23 23:30 出处:网络
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

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) %>
        &开发者_如何学Golt;/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>

<% } %>
0

精彩评论

暂无评论...
验证码 换一张
取 消

关注公众号