Thursday, March 22, 2012

Strange Image Problem

I have created a master page and inserted a couple images. When I look at them in design view the appear as a box with an x in it which is not correct. When I view the page in the browser it displays the image. What is the problem?

Here is the master page code:

<%@dotnet.itags.org. Master Language="VB" %
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd"
<script runat="server"
</script
<html xmlns="http://www.w3.org/1999/xhtml" >
<head runat="server">
<title>Untitled Page</title>
</head>
<body>
<form id="form1" runat="server">
<div>
<center>
<img src="http://pics.10026.com/?src=Images/delilogo.jpg" runat="server"/><br /> <img src="http://pics.10026.com/?src=Images/topmenu.jpg" runat="server"/>
<asp:contentplaceholder id="ContentPlaceHolder1" runat="server">
</asp:contentplaceholder></center>
</div>
</form>
</body>
</html>

The designer in VS is no good. I would rely on your source and forget the designer most of the time. But if you really want the images to appear in the designer, try draging and dropping your images from VS Solution Explorer onto the designer surface.

Hope this helps.


Hinzamorski ,

try the following:

<asp:ImageID="Image1"runat="server"ImageUrl="~/im.JPG"/>


Hi nzamorski,

I'm sure this should work as well as the asp:Image control.

<img src="http://pics.10026.com/?src=Images/delilogo.jpg" runat="server"/>

First, where is your website project located? Is it IIS project or File System project? Please double check the folder structure if the relative path to Images/delilogo.jpg is right. When the website is located in IIS server, the relatvie path to the image in a virtual directory or a web application might be different.

I agree with the guys above, you can drag and drop the image if you are not certain of the path to the image. But first make sure the Images folder is in the root folder of the project. Thus you will find the folder is appearing in the Solution Explorer window of Visual Studio. Pick up the image and drag & drop it into the Design View will be simpler.

Hope it helps.

0 comments:

Post a Comment