I have a class 'IncomeStatement' that is used as a ViewModel. This class has a property that generates some fairly complicated html like this:
public MvcHtmlString HtmlPeriods { get; set; }
....
StringBuilder htmlPeriods = new StringBuilder(100);
htmlPeriods.AppendFormat(
"<td><a href='/Forecast/IndexPeriod?Period={1}'>{0}</a></td>",
inc.NetSales, per.Period.PeriodID);
....
HtmlPeriods = MvcHtmlString.Create(htmlPeriods.ToString())
Then in the Razor file I use the HtmlPeriods property, which works fine:
<th></th>@Model.HtmlPeriods<td></td>
But what if I want to use the Html.ActionLink(...) in my class to create
nice Razorlike links,
something like this:
string forecastLink =
Html.ActionLink("Edit Forecast", "/Forecast/IndexEdit?PeriodID=2005Q1");
How would I do that?