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?
Try:
<title><%= (string) ViewBag.Title %></title>
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With