views:

24

answers:

1

I can see background images in design time. But can't see images in run time. I am running my application from asp.net development server.

I am applying background images by using css.

What is the solution?

<%@ Page Language="C#" AutoEventWireup="true" CodeBehind="Default.aspx.cs" Inherits="BackgroundImageTest._Default" %>

<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd"&gt;

<html xmlns="http://www.w3.org/1999/xhtml" >
<head runat="server">
    <title>Untitled Page</title>
    <link rel="stylesheet" href="Stylesheet1.css" type="text/css" media="screen" />
</head>
<body>
    <form id="form1" runat="server">
    <div>
        abcdef
    </div>
    </form>
</body>
</html>


div
{
    background-image:url(App_LocalResources/database.1.jpg);
    width:400px;
    height:400px;
}
+1  A: 

Did you check if the PATH is still there in runtime ?

Dani
how to check it?
JMSA
and I think that it is better to use a style to apply this.
Dani
put the image on the root folder of the website and remove the path and see if it works.if not - this is not a path problem
Dani
Yes it works. Then why is the problem happening in the sub dir?
JMSA
I am not sure.. need to look at it... it might be a spelling mistake ?
Dani