Portal Engine Questions on portal engine and web parts.
Version 5.x > Portal Engine > Unable to set page title with CurrentTitle View modes: 
User avatar
Member
Member
ewan - 10/12/2010 6:44:51 AM
   
Unable to set page title with CurrentTitle
Hi,

I am attempting to dynamically set meta tags and page title from a web part, no problem setting the meta description and keywords but cannot set the title:

CMSContext.CurrentDescription = "Test" ' This works OK
CMSContext.CurrentKeyWords = "Test" ' This works OK
CMSContext.CurrentTitle = "Test" ' This does not work

I have tried this in Page_Load and Page_Prerender and tried various settings in the page properties for title (turning inheritance on and off, title blank and non-blank).

Any suggestions?

Thanks,
Ewan.



User avatar
Member
Member
ewan - 10/14/2010 1:18:51 AM
   
RE:Unable to set page title with CurrentTitle
Looks like a timing issue. It appears that the title tag has already been set up by the time my web part's Page_load is called.

I have worked around this for now by updating the title tag directly:
CType(Page.FindControl("Title1"), HtmlTitle).Text = "Test"

A bit of a kludge but it works OK.

Ewan.

User avatar
Kentico Developer
Kentico Developer
kentico_ivanat - 10/14/2010 8:32:12 AM
   
RE:Unable to set page title with CurrentTitle
Hi,

Could you please try to use following method?

 
protected override void OnInit(EventArgs e)
{
CMSContext.CurrentTitle = "test";
base.OnInit(e);
}


Best regards,
Ivana Tomanickova