I have a master page called Default.master. I want to set the title using ViewBag.Title. On my controller I have:
public ActionResult Index()
{
ViewBag.Title = "Home";
return View();
}
My Home view uses Default.master as the master view page. On the master view page I am using:
<title><%= ViewBag.Title %></title>
But I get this error:
The call is ambiguous between the following methods or properties: 'System.IO.TextWriter.Write(string, params object[])' and 'System.IO.TextWriter.Write(char[])'
How can I use it properly?
From this blog post I saw a syntax that I’ve never seen before:
This prints an expression, so using:
I got the correct value.