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 1085943
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 16, 20262026-05-16T22:45:07+00:00 2026-05-16T22:45:07+00:00

I am trying to change the master page dynamically, and although it’s easy to

  • 0

I am trying to change the master page dynamically, and although it’s easy to do from a content page (overriding OnPreInit), there is no such event for a master page. Is it possible to introduce this event somehow?

UPDATE: I got halfway there by going via the PreInit of the pages at the bottom of the ladder, turns out you can do things like base.Master.MasterPageFile = "/master.Master";, but for some reason this doesn’t load the stuff in the header of the top-most master page, namely stylesheets.

  • 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-16T22:45:07+00:00Added an answer on May 16, 2026 at 10:45 pm

    Quoting from: Can I change a nested master page's master dynamically?

    Just tested this and it works from the PreInit of the Page that is using the nested MasterPage.
    protected void Page_PreInit(object sender, EventArgs e)
    {
    this.Master.MasterPageFile = “/Site2.Master”;
    }

    Obviously you will need to ensure that the ContentPlaceholderIds are consistent across the pages you are swapping between.

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

Sidebar

Related Questions

I'm trying to change a Button's Click property/event when a DataTrigger is triggered but
I'm trying to change the content of a ContentPresenter to one of my View
I'm trying to pass a value to Page.Title in a nested WebForms Master Page,
I'm trying to add a script reference to jQuery in my master page so
I am dealing with a master page split into various content placeholders as per
Im trying to create a new master page without using a table and its
I'm trying to build a master page. What I'm trying to do is have
I'm looking for a way to (preferably) strongly type a master page from a
I am trying to change the checked attribute of dynamically created html radio button
I’m trying to do dynamic switching of the master page in SharePoint 2007 publishing

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.