I have a list of Report object displayed using Repeater control. In the Report class there is a RecipientsList which is a List of string. I have following code inside the repeater to render the list as a comma separated list.
The code is working fine. Currently it is creating a string inside the div (which has class= “repeaterLine”)
I need each string to be in separate div element. There should be as many div elements as the number of recipients. Is it possible to achieve it in ASP.Net markup (only)?
Markup inside Repeater
<div class="repeaterLine">
<%# String.Join(", ",((ServicesSupportSite.UI.Report)Container.DataItem).RecipientsList)%>
</div>
Report Class
public class Report
{
public int ReportID { get; set; }
public string Title { get; set; }
public List<string> RecipientsList { get; set; }
}
REFERENCE
You can use a LINQ
.Select()to wrap the strings in RecipientsList in<div>tags, like this: