I need to display a list of Person objects, for example, in comma-delimited format using Partial View in ASP.NET MVC. My problem is when rendering using the following code:
<% foreach (var person in Model) { %>
<%= Html.ActionLink<PersonController>(c => c.Edit(person.PersonID), Html.Encode(person.Name)) %>,
<% } %>
I get the trailing comma after the last item. What is the most elegant / least stupid way to get this list of faces without the last comma?
My two options so far, in order, would be the following:
- Use JavaScript to remove trailing comma on client side
- Manually create a list using code, not markup, in a partial view
None of these options work for me - any ideas?
Thanks!