Question

I am having this problem on a site built with Umbraco v3.0.3.

The master page is, as far as I know, stored by the CMS in the database. Thus when I do the following in my master page, it's not being processed and in fact the head isn't runat server. So the following comes through to the page in the browser:

<head runat="server">

Consequently, I'm having problems using the following from within my usercontrol

protected void Page_Load(object sender, EventArgs e)
{
    this.Page.Title = "Lorem Ipsum";
}

Which gives the following server error

Using the Title property of Page requires a header control on the page. (e.g. runat="server" />)

I just want a simple and clean way of setting the page title from a usercontrol!

Was it helpful?

Solution

Did you also embellish the title tag with runat="server" like

<head runat="server">
<title runat="server"></title>
</head>

Off the tangent, why would you need to set the page title from a user control? You would be better of having a page item or umbraco macro(possibly an asp.net user control) sitting inside the <title></title> tag that sets the page title for you.

Licensed under: CC-BY-SA with attribution
Not affiliated with StackOverflow
scroll top