asp.net mvc - What's the most elegant way of using a partial view to render a comma delimited set of items? -
I must present a list of individual items in a comma-delimited format using partial view in ASP.NET MVC. My problem is that when the following code is used:
& lt;% foreach (different person in the model) {%> & Lt;% = HTML.ActionLink & lt; PersonController & gt; (C => c.Edit (person.PersonID), Html.Encode (person.Name))%>, & amp; Nbsp; & Lt;%}% & gt;
I get a backwards comma after the last item
Do not be in the order
- Use javascript to remove tracing commas on the client side
- Use code instead of markup in partial view Make a list manually
None of these options appeals to me - any thoughts?
Thank you!
How about:
& lt;% = string Select .join (",", Select Model (person => HTML.exeLink; Personal Controller & gt; (C => C.Edit (person.PCNID), HTMLN.Code (Person.Name ))) .Oir ())% & gt;
(untested)
Comments
Post a Comment