tags:

views:

750

answers:

4

I have placed an image on the master page.

I see the image at design time.

But I don't see the image at run time.

What can be the problem?

I have tried to place the image on an image box. But it didn't work either.

<%@ Master Language="C#" AutoEventWireup="true" CodeBehind="MasterPage.master.cs" Inherits="Ice_Web_Portal.UI.MasterPage" EnableTheming="true" %>

<!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>.::ICE Web Portal::.</title>
    <link href="App_Themes/SmokeAndGlass/SmokeAndGlass.css" rel="stylesheet" type="text/css" />
</head>
<body >
    <form id="form1" runat="server">
        <table style="position: static">
            <tr>
                <td align="left" colspan="2">
                    <asp:Image ID="Image1" runat="server" ImageUrl="~/App_Themes/Banner.JPG" /></td>
                <td>
                </td>
            </tr>
            <tr>
                <td rowspan="2">
                    <div>
                    &nbsp;</div>
                    &nbsp;</td>
                <td style="width: 3px">
                    <asp:LoginView ID="LoginView1" runat="server">
                        <LoggedInTemplate>
                            <table style="width: 204px">
                                <tr>
                                    <td>
                                        Login Status :</td>
                                    <td>
                    <asp:LoginStatus ID="LoginStatus1" runat="server" />
                                    </td>
                                    <td>
                                    </td>
                                </tr>
                                <tr>
                                    <td>
                                        Login Name :</td>
                                    <td>
                    <asp:LoginName ID="LoginName1" runat="server" />
                                    </td>
                                    <td>
                                    </td>
                                </tr>
                                <tr>
                                    <td>
                                    </td>
                                    <td>
                                    </td>
                                    <td>
                                    </td>
                                </tr>
                                <tr>
                                    <td>
                                    </td>
                                    <td>
                                    </td>
                                    <td>
                                    </td>
                                </tr>
                            </table>
                        </LoggedInTemplate>
                    </asp:LoginView>
                </td>
                <td>
                </td>
            </tr>
            <tr>
                <td style="width: 3px">
                    <asp:ContentPlaceHolder ID="ContentPlaceHolder1" runat="server">
                    </asp:ContentPlaceHolder>
                </td>
                <td>
                </td>
            </tr>
            <tr>
                <td>
                    &nbsp;</td>
                <td style="width: 3px">
                </td>
                <td>
                </td>
            </tr>
        </table>
    </form>
</body>
</html>
+4  A: 

It sounds like you may have a URL mapping issue of some kind... For the ImageURL property try setting it to "~/Images/MyImage.png"...

Rather than storing an image directly in the App_Theme folder, create a folder for images and try to use that instead. The App_Theme directory is handled differently...

RSolberg
I have used like this '~/App_Themes/Banner.JPG'.
JMSA
Now i have a new problem. All pages are showing the banner. Except the Default.aspx page.
JMSA
What is the folder structure for all of the pages?
RSolberg
+2  A: 

It sounds like an issue with Relative Paths in Master Pages to me. The solution is the tilda (~) character, which signifies the root folder regardless where the content page resides.

I just tested your code and it worked for me.

Have you tried it using multiple web browsers? (a caching issue perhaps?)
Are you manipulating the image in the code-behind?

Greg
Plz see the update.
JMSA
+1  A: 

It is a relative path issue, change your stylesheet to:

<link href="~/App_Themes/SmokeAndGlass/SmokeAndGlass.css" rel="stylesheet" type="text/css" runat="server"/>
Cleiton
A: 

Hmm..seems to be perfectly fine. Did you try to use normal HTML tags like

<img src="<sourceToImage>/App_Themes/Banner.JPG"/>

..just to see whether that works.

Another problem could be the UPPER-case "JPG" extension (although I don't know whether that really matters).

Check whether your stylesheet does some operations upon images.

Juri