Applying custom master page on layout pages

I am applying my custom master page on application layout pages which I am deploying using visual studio. My issue is; I have to copy my custom master page in the same directory where my layout pages exist otherwise its not working.
I want to deploy my custom master in the default master page directory and refer it to my layout pages.
is it possible or I have to copy my custom master page in the layout page directory ????

Hi Nazish,
By default your application pages will inherit the masterpage currently applied to the site where your app is hosted, but to specify a custom master on a app page you have to set the "CustomMasterURL" property on your site.
Next your application page needs to inherit from the "LayoutsPageBase" class and you need to specify your custom masterpage on your application page with "~masterurl/custom.master"
Regards, Pieter
MCPD | MCITP
My Blog
Please remember to click "Mark As Answer" if a post solves your problem or "Vote As Helpful" if it was useful.

Similar Messages

  • Sharepoint 2013 - Error while applying custom master page.

    I am getting following error on my sharepoint 2013 site on applying a custom master page.
    System.ArgumentNullException: Value cannot be null.  Parameter name: ribbon    at Microsoft.SharePoint.WebControls.RibbonTrimmer..ctor(SPRibbon ribbon)     at Microsoft.SharePoint.WebControls.SPPageStateControl.OnInit(EventArgs e)
        at System.Web.UI.Control.InitRecursive(Control namingContainer)     at System.Web.UI.Control.AddedControl(Control control, Int32 index)     at Microsoft.SharePoint.WebPartPages.WikiEditPage.OnLoad(EventArgs e)    
    at System.Web.UI.Control.LoadRecursive()     at System.Web.UI.Page.ProcessRequestMain(Boolean includeStagesBeforeAsyncPoint, Boolean includeStagesAfterAsyncPoint)
    Does anyone know whats wrong with my custom master page?

    Hi,
    please check if its properly deployed.
    Refer the similar thread below.
    http://social.technet.microsoft.com/Forums/en-US/f07ce2f6-6607-4764-8c12-10de4ae1d635/systemargumentnullexception-value-cannot-be-null-parameter-name-ribbon?forum=sharepointgeneralprevious
    Please remember to click 'Mark as Answer' on the answer if it helps you

  • Apply custom master page for a new sub site in programming

    Hi;
    How Apply a custom master page for a new subsite ?
    My code is as follows but it not working : the master page is not applied ?
    SPWeb newSite = web.Webs.Add(name, name, name, Convert.ToUInt16(1036), "{815BF557-AFE0-42B4-92A1-A8A56011EDBF}#LaPoste.DTC.ModeleSite", false, false);
    newSite.AllProperties["__InheritsCustomMasterUrl"] = "False";
    newSite.CustomMasterUrl = "/_catalogs/masterpage/iDtc/iDtcGeneric.master";
    newSite.AllowUnsafeUpdates = true;
    newSite.Update();
    Regards

    try this:
    foreach (SPWeb site in siteCollection.AllWebs) {
    if (site.Title.ToString() == "Reporting Portal")
    site.MasterUrl = WebAppRelativePath + "_catalogs/masterpage/Branding101.master";
    //site.CustomMasterUrl = WebAppRelativePath + "_catalogs/masterpage/Branding101.master";
    site.AlternateCssUrl = WebAppRelativePath + "Style%20Library/Branding101/Styles.css";
    site.SiteLogoUrl = WebAppRelativePath + "Style%20Library/Branding101/Images/Logo.gif";
    site.UIVersion = 4;
    site.UIVersionConfigurationEnabled = false;
    site.Update();

  • Apply custom master page on a subsite

    Hi;
    I try to apply a custom master page on a new subsite but without success (any impact) :
    My code is :
    web.AllowUnsafeUpdates = true;
    SPWeb newSite = web.Webs.Add(name, name, name, Convert.ToUInt16(1036), template, false, false);
    newSite.Navigation.UseShared = true;
    newSite.AllProperties["__InheritsCustomMasterUrl"] = "False";
    newSite.CustomMasterUrl = curItem["SiteUrl"] + "/_catalogs/masterpage/rep/Generic.master";
    newSite.AllowUnsafeUpdates = true;
    newSite.Update();
    newSite.Close();
    Regards;

    hi,
    try this 
    SPSecurity.RunWithElevatedPrivileges(delegate
    using (SPSite objSPSite = new SPSite(SPContext.Current.Web.Url))
    using (SPWeb objSPWeb = objSPSite.OpenWeb())
    objSPWeb.AllowUnsafeUpdates = true;
    objSPWeb.MasterUrl = curItem["SiteUrl"] + "/_catalogs/masterpage/rep/Generic.master";
    objSPWeb.Update();
    objSPWeb.AllowUnsafeUpdates = true;
    Whenever you see a reply and if you think is helpful,Vote As Helpful! And whenever you see a reply being an answer to the question of the thread, click Mark As Answer

  • Custom Master page

      how to apply  custom master page site setting page in sharepoint2007 it's passible or not.

    Hello,
    Since layout page inherited from application.master page so your custom master page won't apply to settings page. You can use HHTPmodule to overwrite that master page:
    http://stephenkaye.blogspot.in/2008/03/how-to-customise-applicationmaster-file.html
    http://nikpatel.net/2009/12/20/moss-2007-implementing-the-custom-application-master-page-using-httpmodule/
    If you just want to change the color of links then you can also try with different theme.
    Hope it could help
    Hemendra:Yesterday is just a memory,Tomorrow we may never see
    Please remember to mark the replies as answers if they help and unmark them if they provide no help

  • Get jQuery Document Ready to work in a Custom Layout Page

    Hi
    Working with a branding company I have placed my Bootstrap and JQuery files at the bottom of my custom Master page 
    </footer>
    <!-- Bootstrap core JavaScript -->
    <script type="text/javascript" src="https://code.jquery.com/jquery-1.10.2.min.js">//<![CDATA[
    //]]>
    </script>
    <script type="text/javascript" src="/Style%20Library/Client/js/bootstrap.min.js">//<![CDATA[
    //]]>
    </script>
    <script type="text/javascript" src="/Style%20Library/Client/js/bootstrap-datepicker.js">//<![CDATA[
    //]]>
    </script>
    All good!  Now if I add a   $(document).ready(function()  below the above definitions  and say have a date picker widget marked up this
    works.  
    I have noticed that in my case I am unable to run document ready function at the custom page layout level- only the one in the custom master file is ever executed -  I have tried moving the above definition files into the header as per the sample in
    Bootstrap2.html but SharePoint simply removes them  during the conversion. Moving the same document ready function out of the master into the layout page doesn't work
     I guess my question is am I am have a unique document ready function at the page layout level as this I would have thought this would be possible -  In my case I need my JQuery functon to perform some runtime branding that is unique per  page
    Daniel
    Freelance consultant

    for a quick and dirty implementation, I coded this up which works.  I will see about the other implementation as suggested by Hugh as I am not entirely happy about loading the document ready as there is a slight delays as the body class is set and the
    page is rendered 
    var bodyCSS ;
    function SetBodyCSS()
    var ctx = new SP.ClientContext();
    var site = ctx.get_site();
    var web = ctx.get_web();
    // construct a json object
    ctx.load(web);
    ctx.executeQueryAsync(function(s, a){
    var siteBodyContainerCSS = {
    "Sales": "Pink",
    "IT": "burgundy"
    // lookup the class to set from the title
    bodyCSS = siteBodyContainerCSS[web.get_title()];
    // only bother to set if not null , undefined or empty
    if (bodyCSS)
    $('#s4-bodyContainer').removeClass("default");
    $('#s4-bodyContainer').addClass(bodyCSS);
    else
    alert( ' no body css class defined for ' + web.get_title()) ;
    // now call this to get the body css class
    //]]>
    </script>
    </a>
    <script type="text/javascript">//<![CDATA[
    $(document).ready(function() {
    ExecuteOrDelayUntilScriptLoaded(function () {
    /* your code here */
    SetBodyCSS();
    }, "sp.js");
    $('#dp6').datepicker();

  • How to set custom master page for sharepoint application page ?

    Hello,
    I need to apply custom master page for the custom application page I created for login purpose.
    Can anyone please let me know how to apply master page for custom application page ?
    Note : I need to set custom master page for application page at web application level.
    thanks,
    Dipti Chhatrapati

    Hi Dipti,
    You can use the same reference as ASP.NET
    Example
    "<%@ Page Language="C#" masterpagefile="../_catalogs/masterpage/minimal.master" title="teste" inherits="Microsoft.SharePoint.WebPartPages.WebPartPage, Microsoft.SharePoint, Version=14.0.0.0, Culture=neutral, PublicKeyToken=71e9bce111e9429c" meta:webpartpageexpansion="full"
    meta:progid="SharePoint.WebPartPage.Document" %>"
    You can use SharePoint Designer 2010
    http://www.microsoft.com/download/en/details.aspx?id=16573 to make the reference from you aspx page to you custom masterpage.
    When you are editing a aspx page you can go to ribbon "Style" and attach the custom Masterpage.
    André Lage Microsoft SharePoint, CRM Consultant
    Blog:http://aaclage.blogspot.com
    Codeplex:http://spupload.codeplex.com/http://simplecamlsearch.codeplex.com/

  • Custom Master Page changes wont apply to few page layouts

    Dear All
    I'm having issue applying custom branding to SharePoint 2010 sites.. Branding works overall fine but it doesn't apply to few pages.
    For example if I click on Enterprise and Metadata Keyword Settings in Document library the changes are not applied. I notice it's a page called metadatacolsettings.aspx in layouts and I see it references application.master.. Similarly I see couple
    of other pages out of sync and all of them have application.master as Master Page..
    Any ideas why this could be happening.. Please let me know
    Thanks

    Hi,
    pls check below links
    There are a few things to consider.
    Have all page layouts / master pages been checked in and published / approved?
    Have you created a new page using the custom page layout?
    Are you creating or modifying this content?
    Keep in mind, the progression of rendering goes as follows:
    masterpages determine the ASP.NET structural layout.
    Page Layouts determine the SharePoint structural layout based on the masterpage ASP.NET structural layout.
    Your .aspx pages determine what content to display based on the Page Layout SharePoint structural layout.
     https://social.technet.microsoft.com/Forums/sharepoint/en-US/00d354cd-e49b-429f-8648-50251e1b39a0/changes-to-page-layout-not-refelected-when-using-custom-master-page?forum=sharepointcustomizationlegacy
    Please remember to click 'Mark as Answer' on the answer if it helps you

  • Custom master page applying on Publishing site template not in my site template?

    Hi,
    i have created a custom master page based on Publishing template Using Design manager (means converted html to aspx page) and then set all other control on the master page. now problem is master page applying only on Publishing site template not my site
    template. any one know why its happening, and how can resolve this issue?
    Thanks
    Mohammad

    Feature Stapling may be a solution - Please check -
    http://sharepointologic.blogspot.in/2013/04/branding-sharepoint-2013-my-sites-with.html
    http://www.codeproject.com/Articles/42129/Creating-branded-my-site-in-sharepoint
    Thanks
    Ganesh Jat [My Blog |
    LinkedIn | Twitter ]
    Please click 'Mark As Answer' if a post solves your problem or 'Vote As Helpful' if it was useful.

  • SharePoint 2013 - Custom Master Page / Page Layout

    Hi there,
    - I've covert an HTML file using Design Manager >> Edit Master Pages to convert successfully. Now I've a custom master page.
    - I changed my default master page to custom master page and it looks fine. But the problem is when I try to edit the page all the web parts (snippets) are appears at the bottom of custom master page.
    - So I created new page layout 
    -  After conversion successful.
    - When I can click on new page this message shows up.
    Sorry, something went wrong 
    An invalid or empty reference to a Cascading Style Sheet file was specified. Valid references must specify only a filename that ends with a ".css" extension 
    Thanks for help

    Hi Tim,
    As per my understanding try to do check the below things,
    Try to restore the previous version of master, page layout and the home page and cross check the malfunctioned part by comparing both current and previous content
    Check for special characters added in page layout ,page
    Cross with the content type mapped with this new page layout
    Check for custom solution is retracted from Farm
    Optionally check for any updates gone in server
    OR 
    Refere the below URL if the above wont works,
    https://social.msdn.microsoft.com/Forums/en-US/5045369c-c330-4dc8-97fe-b9ad04830037/css-error-when-changing-the-master-page?forum=commserver2009
    Vijaivel

  • Create a blank page without custom master page applied,left navigation,top navigation

    hi,
     i am having a requirement where in i need to a  show a report- which is actually a  3rd party tool's custom web part -. this web part is a report which has lot of metadata. so customer doesnt want to see the custom master page
    or left navigation, top navigation, right nav in this page.
    is it possible to achieve a  blank  web part page that doesnt have custom master page applied- i mean  this page should not inherit the my custom master page- and just add the custom web part here.
    help is appreciated!
    Das

    Hi
    3 ways.
    1.use a blank page using sharepoint designer
    2. remove applied master page for an existing page
    3 use &isdlg=1 on your URL ( to hide the top of the master page elements )
    http://domain/path/page.aspx&isdlg=1
    Romeo Donca, Orange Romania (MCSE, MCITP, CCNA) Please Mark As Answer if my post solves your problem or Vote As Helpful if the post has been helpful for you.

  • Transferring Custom Master-Page, Custom Page Layouts and Pages created to a new SharePoint Site.

    Hi All,
    I have a SharePoint 2013 Publishing Site for testing named 'Test'. In the Test I have created a Custom Master-Page and several Custom Page Layouts. Also using them I have created  several pages. Now they all are connected to the navigation. Now I want
    to transfer all the pages, custom master-page and custom page layouts to a new site (a publishing site) that will be used as production. Will I able to do this or not. Please advice me with best practices.
    Thanks and regards,
    Chiranthaka

    Hi Chiranthaka,
    thanks for posting your query, The master page can't be copied in designer and pasted into the new site collection. A better approach would be to bundle it into a feature and deploy it to the farm where it can't be activated and used.
    If you want to copy your master page to another site collection you can download your master page from the master page gallery and upload it to the the master page gallery of the second site collection. From the root site Site Actions > Site Settings
    > (Galleries)Master pages and page layouts
    If you want to deploy the same master page to multiple site collections using a feature, create a module in Visual Studio, add your custom master page to the module, and create an element manifest something like this:
    <Elements xmlns="http://schemas.microsoft.com/sharepoint/">
    <Module Name="Master Pages" List="116" Url="_catalogs/masterpage" RootWebOnly="TRUE">
    <File Path="Master Pages\MyCustom.master" Url="MyCustom.master" Type="GhostableInLibrary"></File>
    </Module>
    </Elements>
    The basic idea is to have your site-scoped feature include a module that copies your custom master page from the file system to the masterpage gallery. Since the feature folder is shared, the same master page gets copied to the site collection master page
    gallery whenever you activate the feature.
    I hope this is helpful to you, mark it as Helpful.
    If this works, Please mark it as Answered.
    Regards,
    Dharmendra Singh (MCPD-EA | MCTS)
    Blog : http://sharepoint-community.net/profile/DharmendraSingh

  • Add Right Side Column and Web Parts to custom Master page in SharePoint Online

    Hello everyone, 
    I hope this is a simple question, however I was fighting the issue it presents for a while. I am in the process of customizing SharePoint Online Look-and-feel with a new layout.
    The site collection was created as a
    Team Site before I got involved with the project, and populated with numerous sub-sites and pages. I activated required
    publishing features, created html with corresponding styles and graphics, and used the Design Manager to convert the html file to the custom Master page. While SharePoint automatically assigned “ContentPlaceHolderMain” div area, I
    also used default Oslo page as example to copy sections of the code for dynamic components (left column and navigation, recent items, the ribbon, etc.) from it and placed them in my new master page, pointed all CSS references to
    my custom style sheets, etc. Everything works great, however I need to make one last addition -
    my task is to make changes to display web parts such as Calendar and Recent Documents in the right column in the Master page.
    My custom layout has a header, footer, main pan and two side columns. Most of the default master templates come with the LEFT column already embedded and populated with several placeholder
    to serve dynamic content (PlaceHolderLeftNavBarTop, PlaceHolderQuickLaunchTop, PlaceHolderLeftNavBarDataSource, PlaceHolderLeftActions, so on).
    My challenge is that I have the RIGHT side column as well, for which I don’t think the default placeholder exists. I need to add a small Calendar box and Recent Documents parts to it, so they
    display across the entire site governed by this master page.
    The issue is –
    even after activating Publishing features (enabled SharePoint Server Publishing Infrastructure under Site Collection Level, and SharePoint Server Publishing under the Site
    Level), there is no Snippet feature (usually available under the generic Publishing Site); this customization of the Team Site allows using Designer and apply custom templates, themes, so on, just like you would under the Publishing collection, but not the
    Snippet utility I could use as the solution to embed the web parts on the master page.
    Recreating the entire site under Publishing Collection is not an option due to the directions I was given, I am to use this existing one, and need to see if
    there is a workaround to either activate the Snippet feature or use another solution to display the web parts inside of the column in the Master page.
    If the only solution is to use Web Part Zone, what are the steps to add it AND populate it with the abovementioned apps?
    Can anyone suggest how to create a workaround and add this feature? The environment is role-based so both elements need to be dynamically rendered based on the user’s role and activities.
    I am more of a front end designer than developer, so if any custom coding and set up required, please kindly provide some basic steps, if possible?..
    I greatly appreciate any help and suggestions!
    Thank You!
    Jeff
    Jeff V.

    Updating your Master Page to also include a right rail should be sraight forward enough with a new div or divs in your master page and then the proper styles to make room for this column as well as position the column.
    I have not seen why you cannot find the snippet gallery link when previewing a HTML Master Page in the browser. Have you tried loading the snippet gallery by its url? As an example, for my tenant on SPO, I can load the Snippet Gallery for the olso.master
    with the following url:
    https://pixelmill.sharepoint.com/_layouts/15/ComponentConfigureControls.aspx?ComponentName=TopNavigationNoFlyoutWithStartNode&Url=%2F_catalogs%2Fmasterpage%2Foslo.master
    Change the domain to match yours as well as update the "Url" querystring var to point to your master page. See if that loads the snippet gallery.
    Eric Overfield - PixelMill -
    ericoverfield.com -
    @EricOverfield

  • Page content disappears in Edit mode - Custom Master Page

    Hi All,
    Below are the two issues I have with my master page.
    1) I am facing the strange issue with the pages created using custom page layouts and custom master page.
    In browse mode, everything looks perfect and as expected. But when I try to edit the same page, all content disappears as soon as page ribbon appears. When I click back on Browse tab on the ribbon, everything appears back normally. 
    2) Also When I apply my custom master page as site master for Publishing site it works I can see all my custom design and layout. But when I apply same for team sites, unless I change system master to my custom master page, it doesn't reflect my design.
    Does anyone face this issue before? 
    Thanks
    Pramod
    Pramod

    Once in edit mode, are you able to view the page's source and do a "Find" on a certain keyword that should normally appear in your page's content? Is it there?
    I'm trying to determine if its a server side issue with your master page's code that's causing the content not to be sent back across the wire to the user or if the content is there but just not properly presented. Thanks
    Nikolas Charlebois-Laprade Microsoft Certified Professional & Software Engineer http://nikcharlebois.com

  • Create a custom Master Page in SharePoint Foundation 2013

    Hi,
    I am new to SharePoint foundation.
    I am trying to create a custom master page and save it as template, so that i can use it for all other sub sites. But i don't know where to start. Also i tries searching in Google, i got results for share point and not for share point foundation.
    So, Please give me a step by step procedure or a link to step by step procedure on how to create a master page, save it as template and use it for a sub site.
    Thanks in advance,
    Gowtham R

    Few points to note related to SharePoint Master page:
    You don't need to create master page template. If you deploy your master page in site collection level you can reuse the same master page in subsites without copying again and again, rather just by referencing
    You have not mentioned how you are going to deploy your master page. If you have any Visual Studio (VS) solution already, try to add your  master page in the VS solution and deploy your master page (and other branding components) as SharePoint WSP
    solution.
    Deploying master page will not activate the master page, you need to use some kind of 'Web Level Feature' to activate your branding - the feature will basically set the master page property of SharePoint site to your custom master page.
    Please follow the links below for steps by steps instructions (and you will find many just by googling 'sharepoint master page visual studio'):
    http://frederik.se/how-to-deploy-a-custom-master-page-in-sharepoint-2013-using-visual-studio/
    http://joshuaorimogunje.wordpress.com/2011/10/05/how-to-create-custom-master-page-for-sharepoint-2010-using-visual-studio-2010/
    http://blogs.msdn.com/b/bobgerman/archive/2011/01/31/packaging-master-pages-and-page-layouts-with-visual-studio-2010.aspx
    http://go.limeleap.com/community/bid/291931/Creating-a-Custom-SharePoint-Master-Page-with-jQuery-Using-Visual-Studio
    Thanks,
    Sohel Rana
    http://ranaictiu-technicalblog.blogspot.com

Maybe you are looking for