I am trying to convert the popular asp.net MVC 2.0 solr.net sample app code to Razor syntax. I am not able to understand the last line ... Kindly help
<% Html.Repeat(new[] { 5, 10, 20 }, ps => { %>
<% if (ps == Model.Search.PageSize) { %>
<span><%= ps%></span>
<% } else { %>
<a href="@Url.SetParameters(new {pagesize = ps, page = 1})">@ps</a>
<% } %>
<% }, () => { %> | <% }); %>
[update] Source for Html.Repeat extension
Possibly something like:
}, () => { <text>|</text> });
For this to work you will have to modify the
Html.Repeat
extension method to take advantage of Templated Razor Delegates as illustrated by Phil Haack. And then:UPDATE:
According to your updated question you seem to be using a custom HTML helper but as I stated in my answer you need to updated this helper to use the Templated Razor Delegates syntax if you want it to work. Here's for example how it might look:
or if you want to have the helper method directly return a HelperResult so that you don't need to use the brackets when calling it:
and then inside your view: