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

  1. Use javascript to remove tracing commas on the client side
  2. 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

Popular posts from this blog

c++ - Linux and clipboard -

What is expire header and how to achive them in ASP.NET and PHP? -

sql server - How can I determine which of my SQL 2005 statistics are unused? -