In your transformation you call the GetDates()
function. Your full transformation would look something like this:
public string GetDates()
{
System.Collections.Generic.List<string> allDates = new System.Collections.Generic.List<string>();
DateTime startingDate = Eval<DateTime>("NewsStartDay");
DateTime endingDate = Eval<DateTime>("NewsEndDay");
for (DateTime date = startingDate; date <= endingDate; date = date.AddDays(1))
{
allDates.Add(date.ToShortDateString());
}
return allDates.Join(", ").ToString();
}
<div>
<h2><%# Eval("NewsName") %></h2>
<p><%# GetDates() %></p>
<p><%# Eval("NewsSummary") %></p>
</div>