Sign Up

Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.

Have an account? Sign In

Have an account? Sign In Now

Sign In

Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.

Sign Up Here

Forgot Password?

Don't have account, Sign Up Here

Forgot Password

Lost your password? Please enter your email address. You will receive a link and will create a new password via email.

Have an account? Sign In Now

You must login to ask a question.

Forgot Password?

Need An Account, Sign Up Here

Please briefly explain why you feel this question should be reported.

Please briefly explain why you feel this answer should be reported.

Please briefly explain why you feel this user should be reported.

Sign InSign Up

The Archive Base

The Archive Base Logo The Archive Base Logo

The Archive Base Navigation

  • SEARCH
  • Home
  • About Us
  • Blog
  • Contact Us
Search
Ask A Question

Mobile menu

Close
Ask a Question
  • Home
  • Add group
  • Groups page
  • Feed
  • User Profile
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Buy Points
  • Users
  • Help
  • Buy Theme
  • SEARCH
Home/ Questions/Q 3330720
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 17, 20262026-05-17T23:31:03+00:00 2026-05-17T23:31:03+00:00

If i have an ASP.NET MVC 2 Web Application with the following Views: Main.aspx

  • 0

If i have an ASP.NET MVC 2 Web Application with the following Views:

  1. Main.aspx
  2. Page1.aspx
  3. Page2.aspx

And all Views inherit from a MasterView called Site.master,

I want to be able to have a default Title/H1 for the page, which can be overriden in the deriving Views.

E.g Main.aspx would have “MySite – xxx”, Page1.aspx would have “MySite – Page 1”, Page2.aspx would have “MySite – Page2”.

And if i choose not to set the Title/H1 in a new derived view, the master Title/H1 would be displayed.

With WebForms, i would accomplish this in the following way:

  1. Make the Title/H1 tags on the master runat=”server”
  2. Expose protected properties on the master code-behind
  3. On Page_Load of the derived pages code-behind, set the property (Master.Title = “Page 1”).
  4. On Page_PreRender of the master code-behind, set the Title/H1 tags to “My Site – ” + Title;

How can we accomplish this with ASP.NET MVC?

I could do this in the master:

<title><asp:ContentPlaceHolder ID="TitleContent" runat="server" /></title>

And then set it in the view:

<asp:Content ID="Content1" ContentPlaceHolderID="TitleContent" runat="server">
    MySite - Page 1
</asp:Content>

But i wanted to be able to only specify “Page 1” in the View, and the title gets magically changed to “MySite – Page 1”. Know what i mean? The “MySite – ” part of the title needs to be the template for the title.

I’m probably missing something obvious here. 🙂

  • 1 1 Answer
  • 0 Views
  • 0 Followers
  • 0
Share
  • Facebook
  • Report

Leave an answer
Cancel reply

You must login to add an answer.

Forgot Password?

Need An Account, Sign Up Here

1 Answer

  • Voted
  • Oldest
  • Recent
  • Random
  1. Editorial Team
    Editorial Team
    2026-05-17T23:31:03+00:00Added an answer on May 17, 2026 at 11:31 pm

    With a quick search I found this:

    http://haacked.com/archive/2009/04/03/tipjar-title-tags-and-master-pages.aspx

    explains why

    <title>MySite<asp:content..../></title>
    

    doesn’t work

    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

For the web application (ASP.NET MVC) I'm currently developing, we have the following architecture
I have an ASP.NET MVC web application running from http://localhost/myappname . From jQuery, I
Say I have an application with the following structure. // ASP.NET MVC (Web Project)
I have a Asp.net MVC web application, containing mostly text. I want to put
Here's what I'm trying to do. I have an ASP.NET MVC web application, where
I have developed a MVC web application with ASP.NET MVC and im just wondering
I have created blank Asp.Net-MVC 3 web application and want to write my own
I have one question; In my ASP.NET MVC web application have to do certain
I have to migrate a web application I made with ASP.NET MVC to a
I am writing a web application on Asp.Net MVC 3. Assume that we have

Explore

  • Home
  • Add group
  • Groups page
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Users
  • Help
  • SEARCH

Footer

© 2021 The Archive Base. All Rights Reserved
With Love by The Archive Base

Insert/edit link

Enter the destination URL

Or link to existing content

    No search term specified. Showing recent items. Search or use up and down arrow keys to select an item.