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

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 6, 20262026-06-06T00:14:21+00:00 2026-06-06T00:14:21+00:00

I want to set the masterpage dynamically, But currently I have a base page

  • 0

I want to set the masterpage dynamically, But currently I have a base page with Page_PreInit that initializes/performs varioustasks needed for memberpages.

Now I know you could override the base page by putting (new protected void Page_OnInit(..)) in the member page but I don’t want to as said the base page has got its job to do.

"this.MasterPageFile ="

Is there any way to set the masterpage after or before the Page_PreInit?

Or utilize both Page PreInt and BasePage PreInt ?

Thanks

  • 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-06-06T00:14:24+00:00Added an answer on June 6, 2026 at 12:14 am

    EDIT: Rereading your question, I see your problem:

    public class BasePage : WebPage {
      protected void Page_PreInit(object sender, EventArgs e){
        //do stuff here
      }
    }
    
    public class MyPage : BasePage {
      protected void Page_PreInit(object sender, EventArgs e){
        //overwrites base class functionality
        //Pretty sure you can:
        base.Page_PreInit(sender,e);
      }
    }
    

    Original answer

    http://msdn.microsoft.com/en-us/library/c8y19k6h.aspx#sectionToggle1

    According to MSDN, you can assign it during Page_PreInit.

    Is there a reason to do it before or after Page_PreInit? I’m not entirely sure anything useful comes before pre-init in the page life-cycle anyways.


    (source: microsoft.com)

    There isn’t an earlier hook, except the page constructor, if you could do it there. But you wouldn’t have access to any of the page values yet.

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

Sidebar

Related Questions

I want to set the Masterpage property in Global.asax. This is what I have
I have an ASP.NET page that uses a MasterPage. I have a public bool
I have a content page in my ASP.NET-page and want to set a JScript
Here i want to set theme for a master page but i don't know
I have a MasterPage that contains a hidden field control. I want to get
I want set Listbox background to transparent but not working Is there any idea?
i want set class for repeater when doPostBack for those dataID i wan but
My question is : I have an EditText and I want set a margin
i have a problem, i want set text of a UILabel or UItextView or
I want to set a binding. The problem is that the target is of

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.