Render span element with text from Model

asp.net-mvc, asp.net-mvc-3, html

Solution

If you are using Razor you can use the following.

<span id="territoryName">@Model.Region</span>

Note: the value will be HTML-encoded.

Without HTML-encoding:

<span id="territoryName">@Html.Raw(Model.Region)</span>

Problem

Is there a way to render text into a `span` element when an ASP MVC 3 view loads? For instance if I have `<span id="territoryName"></span>` how would I load the data from `Model.Region` into the `span` element as text?

Original source

Related problems