Thursday, March 29, 2012

setting page title worked, now doesnt?

Weird problem...

all my pages use C# codebehind to set the <title> tag of the pages. As
follows...

in hmtl.. <title id="PageTitle"></title
in code..

protected System.Web.UI.HtmlControls.HtmlGenericControls PageTitle;

and then

PageTitle.InnerHtml = "text";

It works on all pages, and it did work on this one. But then it just stopped
on this page. Still works on all the others... any ideas what's happening?!?!

ta

Danyou need a runat=server in the title tag
I've had this problem on <head>, where the "runat=server" goes away when you
toggle to design mode. Not sure if this is a reported problem, but in my case
I switched to always have a placeholder in <head>, to which in code-behind
I'll add my title, styles, etc.

"Dan Nash" wrote:

> Weird problem...
> all my pages use C# codebehind to set the <title> tag of the pages. As
> follows...
> in hmtl.. <title id="PageTitle"></title>
> in code..
> protected System.Web.UI.HtmlControls.HtmlGenericControls PageTitle;
> and then
> PageTitle.InnerHtml = "text";
> It works on all pages, and it did work on this one. But then it just stopped
> on this page. Still works on all the others... any ideas what's happening?!?!
> ta
>
> Dan
Thanks guys - re-adding runat="server" has sorted the prob! I can sleep
soundly tonight, knowing my page isn't buggered.!!

Thanks a lot :o)

"Dan Nash" wrote:

> Weird problem...
> all my pages use C# codebehind to set the <title> tag of the pages. As
> follows...
> in hmtl.. <title id="PageTitle"></title>
> in code..
> protected System.Web.UI.HtmlControls.HtmlGenericControls PageTitle;
> and then
> PageTitle.InnerHtml = "text";
> It works on all pages, and it did work on this one. But then it just stopped
> on this page. Still works on all the others... any ideas what's happening?!?!
> ta
>
> Dan

0 comments:

Post a Comment