Render span element with text from Model

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?


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>

Need Your Help

Displaying XML info from online source

c# xml

I am trying to create a web service in c# to display xml information pulled from an online source. The site is ""movieititle"&amp;r=XML" where I inserted Underworld as the...

Writing function definition in header files in C++

c++ performance header-files

I have a class which has many small functons. By small functions, I mean functions that doesn't do any processing but just return a literal value. Something like