When I use
@Html.DisplayFor(modelItem => item.Collection.Name)
Everything seems to be ok, but when I use this:
@Html.ActionLink(@Html.DisplayFor(modelItem => item.Collection.Name) + "", "Index", new { })
There are no all foreign characters. First one displays "żółć", second - "żółć
". Why is that? How to fix it?
According to MSDN, Html.DisplayFor
is intended to
Return HTML markup for each property in the object that is represented by the Expression expression.
But your ActionLink
is simply expecting a regular string
to display as the link text.
You better use DisplayNameFor()
instead:
@Html.ActionLink(Html.DisplayNameFor(modelItem => item.Collection.Name).ToString(), "Index", new { })
See DisplayNameFor