?
Solved

Master Page Content place holder with I background image

Posted on 2011-02-26
3
Medium Priority
?
3,314 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
[X]
Welcome to Experts Exchange

Add your voice to the tech community where 5M+ people just like you are talking about what matters.

  • Help others & share knowledge
  • Earn cash & points
  • Learn & ask questions
  • 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 2000 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

What does it mean to be "Always On"?

Is your cloud always on? With an Always On cloud you won't have to worry about downtime for maintenance or software application code updates, ensuring that your bottom line isn't affected.

Question has a verified solution.

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

IntroductionWhile developing web applications, a single page might contain many regions and each region might contain many number of controls with the capability to perform  postback. Many times you might need to perform some action on an ASP.NET po…
User art_snob (http://www.experts-exchange.com/M_6114203.html) encountered strange behavior of Android Web browser on his Mobile Web site. It took a while to find the true cause. It happens so, that the Android Web browser (at least up to OS ver. 2.…
In this video, Percona Director of Solution Engineering Jon Tobin discusses the function and features of Percona Server for MongoDB. How Percona can help Percona can help you determine if Percona Server for MongoDB is the right solution for …
In response to a need for security and privacy, and to continue fostering an environment members can turn to for support, solutions, and education, Experts Exchange has created anonymous question capabilities. This new feature is available to our Pr…

719 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