Reputation: 1503
This is what I'm trying to do:
@{
string.Join(" | ", Html.GetControllerActions().Select(x => Html.ActionLink(x.Name, x.Name)));
}
Basicall I have a list of strings, and I'd like use each one to create an ActionLink and separate them using a pipe. But this doesn't output anything. And how can I make it work?
Edit: I know that this cannot work, but it explains what I'm trying to achieve, I want to separate a list of links based on a list of strings with a pipe "|"
Upvotes: 0
Views: 374
Reputation: 17196
This will output nothing to the renderer. Try to wrap this expression in @Html.Raw(...)
:
@Html.Raw(string.Join(" | ", Html.GetControllerActions().Select(x => Html.ActionLink(x.Name, x.Name))))
Upvotes: 3