Solved

Master Page Content place holder with I background image

Posted on 2011-02-26
3
3,111 Views
Last Modified: 2012-05-11
I am trying to add a background image to one or my contentplaceholder  and it is not working what am I doing wrong.

 <div style ="background-image: url('~/media/images/OFFROADBACKGROUND.png');" > 

See code below

Thanks in advance for you help
<%@ Page Language="C#" MasterPageFile="~/media/master/k4Secondary.master" AutoEventWireup="true" CodeFile="offRoad.aspx.cs" Inherits="offRoad" %>



<asp:Content ID="Content1" ContentPlaceHolderID="ContentPlaceHolder1" Runat="Server">

 <div style ="background-image: url('~/media/images/OFFROADBACKGROUND.png');" > 
 <asp
    <style type="text/css">
          .Green
        {
            font: bold 14pt arial;
            color: Green;
        }
        .Red 
        {
            font: bold 14pt arial;
            color: #ed1c24;
        }
        
        .StepName
        {
            font: bold 20pt atial;
            color: Black;
            
        }
     
        
        li.steps
        {
            padding-bottom: 10px;
            list-style-image: none;
        }
      
        
    </style>

    

<div style="height: 259px">
  <asp:Image ID="Image1" runat="server" ImageUrl="~/media/images/QuoteBox.gif" 
        align="Left" hspace="10" vspace="10" Height="239px" Width="256px" />
    <p style="font-size: 13pt;padding-left:15px;text-align: left; height: 226px;">
        <br />       
         Here at  we do more than just tires.  We offer a complete line of Jeep or Truck Lift Kits, Springs, Shocks, Leveling Kits and much more.
        Tire wants to handle all your Truck and Jeep susemsion needs.  We carry all top brands for your truck and Jeep needs including but not limited to
         Pro Comp, Fabtech, Rancho, Super Lift, RCD, Daystar, Truxxx, Ready Lift, Fox, King, Edelbrock, Rize, Bilstien, Air LIft, Sky Jacker, 
         and many others. Tell us about your needs for a preformance lift upgrade and WE Will do the rest! 
	</p>


    <br/><br/>
     </div>
 








<br/><br/>
<br/><br/>
    <p>
      <asp:Image ID="Image2" runat="server" ImageUrl="~/media/images/AIRLIFT.gif" 
            align="Left" hspace="0" vspace="0" Width="130px" />
      
    
      <asp:Image ID="Image4" runat="server" ImageUrl="~/media/images/Daystar.gif" 
            align="Left" hspace="0" vspace="0" Height="76px" Width="214px" />
      <asp:Image ID="Image13" runat="server" ImageUrl="~/media/images/CST.gif" 
            align="Left" hspace="0" vspace="0" Height="108px" />
      <asp:Image ID="Image10" runat="server" ImageUrl="~/media/images/SkyJacker.gif" align="Center" hspace="10" vspace="10" />
        <asp:Image ID="Image6" runat="server" ImageUrl="~/media/images/ProComp.gif" align="Left" hspace="10" vspace="10" />


      <br />
       <asp:Image ID="Image5" runat="server" ImageUrl="~/media/images/Fox.gif" align="Right" hspace="10" vspace="10" />
      
    
      <asp:Image ID="Image7" runat="server" ImageUrl="~/media/images/RCD.gif" align="Center" hspace="10" vspace="10" />
         <br />
       <asp:Image ID="Image8" runat="server" ImageUrl="~/media/images/Fabtech.gif" align="Right" hspace="10" vspace="10" />
      
      <asp:Image ID="Image9" runat="server" ImageUrl="~/media/images/Rize.gif" align="Left" hspace="10" vspace="10" />
      
          <br />
       <asp:Image ID="Image11" runat="server" ImageUrl="~/media/images/SuperLift.gif" align="Right" hspace="10" vspace="10" />
      
      <asp:Image ID="Image12" runat="server" ImageUrl="~/media/images/TRUXXX.gif" align="Left" hspace="10" vspace="10" />
     


</p>

 </div>
</asp:Content>

Open in new window

0
Comment
Question by:BBQMemphis
  • 2
3 Comments
 
LVL 29

Expert Comment

by:Paul Jackson
ID: 34989745
Using a ~ in a relative path only works for server side controls.
Use a relative path without using ~ if possible or use an absolute path.
If the content page is in the root of your website you would use :

<div style ="background-image: url('/media/images/OFFROADBACKGROUND.png');" > 

alternatively you could turn your div into a servercontrol :

<div style ="background-image: url('~/media/images/OFFROADBACKGROUND.png');" runat="server">
0
 
LVL 9

Expert Comment

by:mayank_joshi
ID: 34990913
try this:-

<div style ="background-image: url('<%="~/media/images/OFFROADBACKGROUND.png" %>');" > 

Open in new window

0
 
LVL 9

Accepted Solution

by:
mayank_joshi earned 500 total points
ID: 34990957
sorry ignore the above post and try this:-

<div style ="background-image: url('<%=this.ResolveUrl("~/media/images/OFFROADBACKGROUND.png") %>');" > 
1

Featured Post

PRTG Network Monitor: Intuitive Network Monitoring

Network Monitoring is essential to ensure that computer systems and network devices are running. Use PRTG to monitor LANs, servers, websites, applications and devices, bandwidth, virtual environments, remote systems, IoT, and many more. PRTG is easy to set up & use.

Question has a verified solution.

If you are experiencing a similar issue, please ask a related question

In .NET 2.0, Microsoft introduced the Web Site.  This was the default way to create a web Project in Visual Studio 2005.  In Visual Studio 2008, the Web Application has been restored as the default web Project in Visual Studio/.NET 3.x The Web Si…
Problem Hi all,    While many today have fast Internet connection, there are many still who do not, or are connecting through devices with a slower connect, so light web pages and fast load times are still popular.    If your ASP.NET page …
This Micro Tutorial will teach you how to censor certain areas of your screen. The example in this video will show a little boy's face being blurred. This will be demonstrated using Adobe Premiere Pro CS6.
Microsoft Active Directory, the widely used IT infrastructure, is known for its high risk of credential theft. The best way to test your Active Directory’s vulnerabilities to pass-the-ticket, pass-the-hash, privilege escalation, and malware attacks …

822 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question