I would like to include
@Html.ActionLink()
commands in my resource file, but can’t get them display properly when I call on the resource. Basically a resource entry like this:
<div>Click here to @Html.ActionLink("contact us", null)</div>
displays as
Click here to @Html.ActionLink("contact us", null)
instead of
Click here to contact us
in my view. Is there any way to get the razor tags to be properly read?
I don’t think you can embed actual code in the resource file, and expect the view engine to invoke that at render time, it probably thinks it’s just a string (and it shouldn’t have to think any more than that).
A better way would be to use
string.Format.Store the resource as:
And then in the View (i’m guessing your using Razor):
If your doing this a lot, you could also “sweeten it up” with a custom HTML helper:
And then: