asp.netc#-4.0webformspage-title

ASP.NET / C# Page Title


OK I know this is a stupid question and I really don't know what or how to search for this problem. The problem is that I am storing the page Title values into database and then retrieving the values from database and assigning that title to the page using this piece of code this.Title = pageTitle; and it is rendering as following

    <head><title>
          page title here
    </title>

but my manager wants me to make it render as following

    <head><title>page title here</title>

I don't have any idea what to search or how to do it :( I am using ASP.NET 4 and C# 4 over IIS 6 and Windows Server 2003 (SQL Server 2008 R2 if that helps)

EDIT: I have tried

     <head><title><asp:Literal ID="ltrlMasterTitle" runat="server" Text=""</asp:Literal></title>

And setting it to my desired value using the following code

    Literal lblMasterTitle = (Literal)this.Page.Master.FindControl("lblMasterTitle");
    if (!string.IsNullOrWhiteSpace(pageTitle))
        lblMasterTitle.Text = pageTitle;

but it also renders the same way. PS: I tried to use the solution suggested by Jonathan Hanson but I couldn't figure out the transfer of data between master page and the child page :/

ANOTHER EDIT: I have tried the method suggested in Jonathan Hanson's link but that also render the same o.O


Solution

  • here is my answer so that anyone having this kind of stupid situation can gain some wisdom from my experience, after banging my head to the wall for a week I think this cannot be accomplished.