Solved

Master Page Content place holder with I background image

Posted on 2011-02-26
3
3,055 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

Why You Should Analyze Threat Actor TTPs

After years of analyzing threat actor behavior, it’s become clear that at any given time there are specific tactics, techniques, and procedures (TTPs) that are particularly prevalent. By analyzing and understanding these TTPs, you can dramatically enhance your security program.

Join & Write a Comment

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…
ASP.Net to Oracle Connectivity Recently I had to develop an ASP.NET application connecting to an Oracle database.As I am doing it first time ,I had to solve several problems. This article will help to such developers  to develop an ASP.NET client…
This tutorial demonstrates a quick way of adding group price to multiple Magento products.
You have products, that come in variants and want to set different prices for them? Watch this micro tutorial that describes how to configure prices for Magento super attributes. Assigning simple products to configurable: We assigned simple products…

747 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

Need Help in Real-Time?

Connect with top rated Experts

11 Experts available now in Live!

Get 1:1 Help Now