Unlocking the Secrets: Adding Multiple Contents to Your Master Page in ASP

I need some clarification on a dilemma I'm facing.

My master page has a content placeholder that is used by all subpages:

<%@ Master Language="C#" AutoEventWireup="true" CodeFile="Site.master.cs" Inherits="SiteMaster" %>

<!DOCTYPE html>
<html lang="en">
<head runat="server">
<meta charset="utf-8" />
<title><%: Page.Title %></title>

<!--[if !IE]> -->
<link rel="stylesheet" href="theStyles/adipoli.css" type="text/css" charset="utf-8" />
<!-- <![endif]-->

<script type="text/javascript" src="theScripts/placeholders.jquery.min.js"></script>
<script type="text/javascript" src="theScripts/jquery.appear.js"></script>

<!-- default stylesheets -->
<link rel="stylesheet" type="text/css" href="theStyles/defaultStyle.css" />
<link rel="stylesheet" type="text/css" href="theStyles/captionStyle.css" />
<link rel="stylesheet" type="text/css" href="theStyles/footerLinks.css" />
<!-- end default stylesheets -->

<!-- if IE version 9 or less -->
<!--[if lte IE 9]>
<link rel="stylesheet" type="text/css" href="theStyles/defaultStyle_ie.css" />
<link rel="stylesheet" type="text/css" href="theStyles/captionStyle_ie.css" />
<![endif]-->

</head>
<body>
    <form runat="server">
        <asp:ContentPlaceHolder runat="server" ID="FeaturedContent" />
<!-- ################################################################################ -->
<!-- ###                                                                          ### -->
<!-- ### The below contents will be visible in every page unless otherwise stated ### -->
<!-- ###                                                                          ### -->
<!-- ################################################################################ -->
<!-- ### BEGIN LEFT SIDE MENU ### -->
<!-- ### END LEFT SIDE MENU ### -->
<!-- ### BEGIN TOP RIBBON ### -->
<div id="headerRibbon">
    <span id="socialIcons">
        <asp:HyperLink title="Compant Homepage" href="Default.aspx" ClientIDMode="Static" runat="server">
            <asp:Image src="theImages/wmlogo.png" width="219" height="47" alt="Compant Medical Group Homepage" title="Compant Medical Group Homepage" runat="server" />
        </asp:HyperLink>
    </span>

    <div id="tSearch">
        <!--[if lte IE 8]>
            <input id="searchText" name="" type="text" size="40" placeholder="Search Compant" />
        <![endif]-->
        <!--[if gte IE 9]><!--> 
            <asp:TextBox ClientIDMode="Static" ID="searchText" size="40" placeholder="Search" runat="server"></asp:TextBox>
        <!--<![endif]--> 
    </div>
</div>
<!-- ### END TOP RIBBON ### -->

<!-- ### BEGIN BOTTOM RIBBON ### -->
<div id="strip">
</div>
<div id="footerRibbon" class="footerRibbon">
    <asp:Label runat="server" ClientIDMode="Static" ID="copyRight" Text="© 2009-14 COMPANY"></asp:Label>
</div>
<!-- ### END BOTTOM RIBBON ### -->
        <script type="text/javascript" src="theScripts/defaultScript.js"></script>
    </form>
</body>
</html>

About Us:

<%@ Page Title="About" Language="C#" MasterPageFile="~/Site.Master" AutoEventWireup="true" CodeFile="about.aspx.cs" Inherits="about" %>

<asp:Content runat="server" ID="BodyContent" ContentPlaceHolderID="FeaturedContent">

</asp:Content>

Contact Us:

<%@ Page Title="Contact" Language="C#" MasterPageFile="~/Site.Master" AutoEventWireup="true" CodeFile="contact.aspx.cs" Inherits="contact" %>

<asp:Content runat="server" ID="BodyContent" ContentPlaceHolderID="FeaturedContent">

</asp:Content>

Here is a preview of what it will look like:

If there are Webparts on the About Us page with their own HTML code that certain users should be able to edit, is it possible with the current setup of my Master page? Or do I need separate content placeholders for each subpage to achieve this?

Answer №1

To effectively create a SharePoint master page that fully supports all SharePoint features, such as the ribbon, I recommend starting with a standard master page and customizing it rather than building a new one from the ground up.

Your existing master page may not be compatible with web parts due to missing essential JavaScript, CSS files, controls, and more. For instance, including the SPWebPartManager control in your page is necessary to enable web part functionality (already present in the standard master page).

Once you have integrated all the required elements, the next step is to incorporate the WebPartZone control on your page to allow users to seamlessly add web parts.

<WebPartPages:WebPartZone runat="server" FrameType="Standard" ID="MainHeader" Title="loc:Main Header">
    <ZoneTemplate>
    </ZoneTemplate>
</WebPartPages:WebPartZone>

Similar questions

If you have not found the answer to your question or you are interested in this topic, then look at other similar questions below or use the search

Challenges with integrating a Bootstrap 4 table into a card component

Here is a problem I am facing. It seems that the table inside the card is not displaying correctly. I want the table to be centered or at least eliminate the blank space that is currently showing. Here is my code (using Angular 6): <div class="row ...

Retrieve a pair of columns from the database by utilizing SQLalchemy

Currently, I am delving into Python and endeavoring to generate a drop-down menu within my form by utilizing data from another table. Here is the code snippet I have been working on: In my Models.py file: class empmasterModel(db.Model): __tablename__ ...

Designing a flawless CSS pattern for the online world

Currently, I am working on creating a seamless CSS pattern for the web. Even though this may seem impractical and nonsensical, I find joy in experimenting with it. View my progress here After successfully designing my first tile, my next challenge is to ...

Customizing the arrow of a Bootstrap tooltip and adjusting its positioning

I've implemented a bootstrap tooltip to show an image in it. So far, I've been successful in achieving this. https://i.sstatic.net/hgzyL.png However, my current requirement is as follows: https://i.sstatic.net/xcxWZ.png I would like to adjust ...

Struggling to resolve a glitch in the mobile navigation that requires attention either through JavaScript or CSS coding

I'm having an issue with a mobile navigation menu I created. It's a simple hamburger icon that, when clicked, opens a fullscreen menu. The problem is that I want to prevent scrolling when the overlay is visible. I tried using this code: $(' ...

The behavior of ITelemetryProcessor when implemented on an AppService platform

I have developed a custom telemetry processor that includes customer properties in the telemetry data. While testing locally, everything works fine and I can see the properties added and logged in AppInsights without any issue in both release and debug mod ...

What is the solution for the error "At-rule or selector required" ?

Can someone help me with my CSS code issues? I'm having trouble on the first and last lines. Total newbie here :) Error Messages: at-rule or selector expected (ln 1, Col 1) at-rule or selector expected (ln 51, Col 1) &bso ...

Tips for swapping out a new line character in JavaScript

Hello! I'm currently facing a challenge with some code. I have a function designed to replace specific HTML character values, such as tabs or new lines. However, it's not functioning as expected. var replaceHTMLCharacters = function(text){ tex ...

The hover effects cease before the cursor is even shifted

Can someone explain why the hover effect stops before the mouse is moved off the element? I implemented the hover effect on a before pseudo element. ...

The presence of the target tag remains unchanged when a media query is used

Hello, I have a question regarding a specific issue in my code. I am trying to use a media query to make a tag disappear when the width of the window is less than 1200px, but it's not working as expected. I believe it might be related to inheritance. ...

Is it feasible to generate emojis using a gulp Icon-font task?

I'm in the process of creating a script that can generate fonts from SVG images, and so far it's been successful (using similar code to what's provided on https://www.npmjs.com/package/gulp-iconfont) Now I have a more specific question - is ...

Determining the browser width's pixel value to enhance responsiveness in design

Lately, I've been delving into the world of responsive design and trying to grasp the most effective strategies. From what I've gathered, focusing on content-driven breakpoints rather than device-specific ones is key. One thing that would greatl ...

Issue with PrimeFaces radiobutton styles not updating after being clicked programmatically

My setup includes a p:selectOneRadio constructed like this: <p:selectOneRadio id="positionRadio" value="#{employeeBean.empPosition}" converter="#{empPositionConverter}" layout="custom" required="true" requiredMessage="Please select ...

Discover the following input

Can someone assist me? I am looking for a way to automatically move the cursor to the next input field after filling out the first one. Here is the code snippet I have been working with: jQuery: $('input').keyup(function(){ if($(this).val().m ...

Transfer data from a PHP script to a web address without causing a redirection

On my PHP page located at www.aaa.com, I want to send the data entered in a textbox as post data to an ASPX webpage at www.bbb.com when the send button is clicked. Could someone please provide me with the appropriate ASPX code for retrieving post data int ...

What is the best way to place a div inside a navbar element inline?

Having a bit of trouble with my HTML code. I'm working on creating an offcanvas navbar. Here's the code snippet: <nav class="navbar navbar-dark bg-dark"> <div class="container-fluid"> <a cl ...

Modifying text input in Angular

I am working on an Angular form that includes a text input which I would like to be able to edit by clicking on the edit button. Within the form, there are 3 buttons available: edit, cancel (which discards changes), and save (which saves changes). When t ...

Optimizing images for typography in SEO

Dealing with font rendering issues across different platforms can be quite challenging (for example, Windows often has unsightly anti-aliasing, and TTF fonts are not anti-aliased at all). This led me to consider generating a separate PNG file for each head ...

A guide on dividing a string in C#

I need help extracting a sub string from my string that falls between 10:30 and 11:30. I'm unsure of how to go about doing this. Here is an example string for reference: "This is my string at -10:30 to 11:30-"; ...

Utilize CSS styling on dynamically loaded HTML content

I am working on a project similar to the StackOverflow editor. I am fetching markdown text, converting it to HTML, and then displaying it in a preview area. However, when I try to style the injected HTML elements using CSS, the styles are being ignored. Up ...