How do I get <%= Html.Encode(item.name) %> in the title and head of page elements
How do I get <%= Html.Encode(item.name) %> in the title and head of page elements
I am wanting to use this the content place holder - title content, and main content. However each time I try to add these in the those elements i get an error basically saying this not allowed.
<h2>Performances for :<%= Html.Encode(item.venue) %></h2>
this is what I have been doing but it开发者_Go百科 wont work
can somebody please help with my query, thanks.
Remove the runat="server"
attribute from your <head>
tag. It's legacy left from the good ol' days of WebForms which has no any viable meaning in MVC that someone forgot to remove from the default template.
Also if the item
variable is not available in the masterpage you could use a content placeholder which will be redefined in each view if this variable is part of a view model which is only available in views.
Maybe try it without putting <h2>
tags into the <title>
section of the page.
精彩评论