Page name to reflect on Brower Tab/Bar

Jan 14, 2011 at 11:19 PM

I have two custom pages and I would like for them to function like the other pages and reflect the page name in the brower tab.

An example would be the contact page.  When you are there you see "<site name> | Contact" on the browser tab and bar at the top.  I have added Name/Value in the labels.resx file and my pages have the below as an example:

public partial class XML_youtube_search : BlogEngine.Core.Web.Controls.BlogBasePage

I have also rebuilt from the source code but I still do not get what I am looking for.   What step(s) am I missing?

I do get "<site name> |" but that is all.

Thanks in advance.

Jan 14, 2011 at 11:38 PM

If I remember correctly, the Title property of the Page object for currently selected page is displayed on the task bar. you can set it programmatically.

Cheers

Jan 15, 2011 at 12:59 AM

neuromancer,

Thanks for the reply.  I did some more searching and I see the below:

protected override void OnLoad(EventArgs e)
    {
        base.OnLoad(e);

//some other content

Page.Title = Server.HtmlEncode(Resources.labels.contact);
        base.AddMetaTag("description", Utils.StripHtml(BlogSettings.Instance.ContactFormMessage));
    }
Is the Page.Title how you get this done?  I have added the above to my pages and changed the label to my newly added label but still no luck.

Jan 15, 2011 at 1:35 AM

Page.Title works for me.  Perhaps the Title property is overridden within inherited class.

let me try it on some BlogEngine page.

 

Jan 15, 2011 at 2:02 AM

Please, take a look at post.aspx.cs where the Title is dynamically calculated.

Cheers

Jan 15, 2011 at 2:15 AM

OK....I have lead you down the wrong road.  Sorry!  By custom pages I mean pages that I have built that are outside the normal build and not part of the normal "page" process.  As an example the page is http://thenetheryfamily.com/gallery.aspx

Here is the relevant code:

public partial class gallery : BlogEngine.Core.Web.Controls.BlogBasePage
{
    #region Public Properties

    public string GalleryThumbnail;
    public string GalleryTitle;
    public string GallerySummary;
    public int GalleryNumberOfPhotos;
    public string GalleryId;
    public string GalleryName;
    public string GalleryDate;

    #endregion

    private string _username;
    private PicasaService _service;
    private static List<gallery> _galleries;
    const string KEY = "galleries";

    protected void Page_Load(object sender, EventArgs e)
    {
        Page.Title = Server.HtmlEncode(Resources.labels.photoGallery);
        base.AddMetaTag("description", Utils.StripHtml(Resources.labels.photoGallery));

I do get the description in the head of the page with the label "Photo Galleries" but I only get the below in the title.

<title>
	The Nethery Family | 
</title>

I am not sure where I am going wrong

Thanks Again!

Jan 15, 2011 at 1:01 PM

There are complications in this case. because evidently master page overrides the Title.

You could try to analyze archive.aspx which does more or less the same, as you'd like to do.

Jan 15, 2011 at 2:16 PM

Well....after spending a few hours tryingto figure this out I found what the problem was.  In the aspx page I had:

<%@ Page Title="" Language="C#"  AutoEventWireup="true" CodeFile="gallery.aspx.cs" Inherits="gallery" %>

Do you see the "Title=""" 

That was overriding the codebehind.

Details!