Is there away to set a background image on a webpage when the webpage is based on a masterpage. Notice its not the background of the masterpage i want to change, but the background of the page which use the masterpage.
4 Answers
You can just add a style rule for body{} or whatever on the actual ASPX page. It will override any style set at the master page level.
edit: example:
<%@ Page Title="Example" Language="C#" MasterPageFile="~/MasterPages/Main.master"
AutoEventWireup="true" CodeBehind="TroubleShootScanning.aspx.cs"
Inherits="SpectrumTechnologies.TroubleShootingScanning" %>
<asp:Content ID="Content1" ContentPlaceHolderID="mainContent" runat="server">
<style type='text/css'>
body { background-image: url(images/bgimage.jpg); }
</style>
<!-- the rest of the page here -->
</asp:Content>
This will override any values set in a stylesheet.
1 Comment
You could put a content placeholder on the master page that is within the header.
Then in your content page, put a content control where you could include the second modified CSS stylesheet or STYLE block directly.
1 Comment
I suggest adding an <asp:ContentPlaceHolder ID="ExtraStyles" runat="server" /> tag to the header of the Masterpage. That way you can add the following to your page:
<asp:Content ID="ExtraStylesContent" ContentPLaceHolderId="ExtraStyles" runat="server">
<style type="text/css">
body {background-image:url('someotherimage.jpg');
</style>
</asp:Content>
By adding an extra ContentPlaceHolder you won't get the scattered style tags, they will end up in the head tag of the rendered html.