Reputation: 1835
I have the following code:
<% string NewTitle = ""; %>
<%
if (Page.Title.ToLowerInvariant().Trim() == "home page")
{
NewTitle = "CCS LABS";
}
else
{
NewTitle = Page.Title + " - CCS LABS";
}
%>
<title> @NewTitle </title>
I am checking to see if the current age is the "Home Page" if it is, then I change the the title to "CCS LABS" - if it is not then I add " - CCS LABS" to the title and set the title to @NewTitle
When I break on the if statement the code recognises I am in the home page and sets NewTitle accordingly. However, it then jumps over the section. The page is still titled "Home Page".
Any ideas?
Upvotes: 0
Views: 36
Reputation: 8765
@var is razor syntax. you cant use it in an aspx or ascx file. Change you code to this:
<% string NewTitle = "";
if (Page.Title.ToLowerInvariant().Trim() == "home page")
{
NewTitle = "CCS LABS";
}
else
{
NewTitle = Page.Title + " - CCS LABS";
}
%>
<title> <%= NewTitle %> </title>
Upvotes: 1