Is there a way to use a feature similar to what is called Global Variables in the Spark View Engine, but for Razor.
The whole lis point should be able to define a variable in one section for the header, and then be able to set or change the value of this variable later in another section.
In Spark, you will create a variable as a section like this (incomplete code, for example, for purposes):
<html>
<head>
<global type='string' Title='"Site Name"'/>
<title>${Title}</title>
</head>
<body>
<div><use content="view"/></div>
</body>
</html>
And then you can install it in another view or section or something else:
<set Title='product.Name + " - " + Title'/>
How can I do something like this in Razor or just solve a similar problem if I have the wrong approach?
source
share