locked
Custom Application Page Master Page RRS feed

  • Question

  • How to set different master page for particular custom application page.

    I have tried replacing dynamicmasterurl attribute at aspx page but no success

    Also tried to add masterurl in preinit method but it gives error.

    Wednesday, August 12, 2015 9:57 AM

Answers

  • add bellow code to your page Code behind :
    protected override void OnPreInit(EventArgs e) 
    { 
     this.MasterPageFile = "~/customMaster.master"; 
     base.OnPreInit(e); 
    } 


    yaşamak bir eylemdir

    • Marked as answer by BarneyRobin Friday, August 14, 2015 5:58 AM
    Wednesday, August 12, 2015 10:53 AM

All replies

  • add bellow code to your page Code behind :
    protected override void OnPreInit(EventArgs e) 
    { 
     this.MasterPageFile = "~/customMaster.master"; 
     base.OnPreInit(e); 
    } 


    yaşamak bir eylemdir

    • Marked as answer by BarneyRobin Friday, August 14, 2015 5:58 AM
    Wednesday, August 12, 2015 10:53 AM
  • Hi, 

    Hope this may helps you

     private const string MasterPageDirectory = "/_catalogs/masterpage/Welcome.master";
            protected override void OnPreInit(EventArgs e)
            {
                base.OnPreInit(e);
                this.MasterPageFile =SPContext.Current.Site.ServerRelativeUrl+ MasterPageDirectory;
            }


    Sundar

    Wednesday, August 12, 2015 11:39 AM
  • Hi,

    How are you replacing the dynmicmasterurl on the page? You shuld be able to use other master page using MasterPageFile attribute.

    MasterPageFile="~/_layouts/minimal.master"

    Also, please ensure that the master page you are trying to apply has the placeholder you are using on the application pages.

    Hope it helps.

    Regards,

    Akhilesh Verma

    Wednesday, August 12, 2015 12:02 PM