472,800 Members | 1,289 Online
Bytes | Software Development & Data Engineering Community
Post Job

Home Posts Topics Members FAQ

Join Bytes to post your question to a community of 472,800 software developers and data experts.

Image Not Showing


I am using Borland Developer 2006, C# web application. Fairly new to
the .net platform and very new to repeaters.

I have 2 repeaters on a page, both of which are filled from a
database. The Links in the left hand column are created correctly and
displayed. The images/Links (hrefs) in the right hand column are the
problem. The links are displayed correctly but the images are not
displayed. The html is build dynamically. I have debugged the
application and copied the link that has been built. When I paste it
into the html and run it the images are displayed correctly. It is
driving me nuts.

The following is an example of the string that is built dynamically.

"<p><ASP:Image id="TheImage1" runat="server" height="80px"
width="140px" imageurl="Images/Image2.jpg" alternatetext = "Google Web
Page"></ASP:Image><br><a href="http://www.google.co.uk">Google</a></

In all cases the images exist.

Can anyone please help ?

Thanks in advance for any assistance offered.
3 Column CSS example.

<title>My Title</title>
<meta http-equiv="content-type" content="text/html;
charset=iso-8859-1" />
<link rel="stylesheet" type="text/css" href="CSS/Standard.css" />

<div id="content">
<h1>My Title</h1>
<p>This is The Main Body Of The Page</p>

<!-- The following is the left hand column. It is built mainly
from a table of links from a database table -->
<div id="side1">
<h4>Search Our Pages</h4>
<form method="post" action="">
<input class="inputBox" name="textfield" class="inputBox" /><br />
<input type="submit" name="Submit" value="Submit" /><br /><br />
<!-- The first repeater -->
<asp:Repeater id="Repeater1" OnItemCreated="R1_ItemCreated"
<ItemTemplate><%# DataBinder.Eval(Container.DataItem, "Ticker") %>

<!-- The right hand column. It is built mainly from a table of
Images/Links from a database table -->
<!-- This is where the problem lies. The links are displayed
but the images are not -->
<div id="side2" border="1">
<asp:Repeater id="Repeater2" OnItemCreated="R1_ItemCreated"
<ItemTemplate><%# DataBinder.Eval(Container.DataItem, "Ticker") %>

The code behind is

protected void R1_ItemCreated(Object Sender, RepeaterItemEventArgs
String iTypeText = "";

switch (e.Item.ItemType) {
case ListItemType.Item:
iTypeText = "Item";
case ListItemType.AlternatingItem:
iTypeText = "AlternatingItem";
case ListItemType.Header:
iTypeText = "Header";
case ListItemType.Footer:
iTypeText = "Footer";
case ListItemType.Separator:
iTypeText = "Separator";

public class PositionData

private string ticker;

public PositionData(string name, string ticker, string PType,
string PImageId, string PTheImageName, string TheAlternateText, string
PTheImageText, string PHRef)
this.ticker = "";
if (PType == "Link")
this.ticker = "<li><a href=" + ticker.Trim() + ">" + name.Trim()
+ "</a></li>";
if (PType == "AdBox")
this.ticker = "<p><ASP:Image
id=\"" + PImageId + "\" runat=\"server\" height=\"80px\" width=\"140px
\" imageurl=\"" + PTheImageName + "\" alternatetext = \"" +
TheAlternateText + "\"></ASP:Image><br><a href=\"" + PHRef + "\">" +
PTheImageText + "</a></p>";

public string Ticker
return ticker;
private void Page_Load(object sender, System.EventArgs e)
string LLabel = "";
ArrayList values = new ArrayList();

OleDbConnection con = new
OleDbConnection("Provider=Microsoft.Jet.OLEDB.4.0; Data Source=" +

OleDbCommand cmd = new OleDbCommand();

string LSqlString = "Select * From Links";
cmd.Connection = con;
cmd.CommandType = CommandType.Text;
cmd.CommandText = LSqlString;
OleDbDataReader reader = cmd.ExecuteReader();
LLabel = "<ul>";
values.Add(new PositionData(LLabel, "", "","", "", "", "", ""));
while (reader.Read())
string LFormName = reader[0].ToString();
string LSection = reader[1].ToString();
string LLinkName = reader[2].ToString();
string LLink = reader[3].ToString();
values.Add(new PositionData(LLinkName, LLink, "Link","", "", "",
"", ""));
LLabel = "</ul>";
values.Add(new PositionData(LLabel, "", "","", "", "", "", ""));
Repeater1.DataSource = values;



LSqlString = "Select * From Images";
cmd.Connection = con;
cmd.CommandType = CommandType.Text;
cmd.CommandText = LSqlString;
OleDbDataReader reader2 = cmd.ExecuteReader();

int LCounter = 1;
LLabel = "<div class=\"adbox\">";
values.Add(new PositionData(LLabel, "", "","", "", "", "", ""));

while (reader2.Read())
string ImageFormName = reader2[0].ToString();
string ImageSection = reader2[1].ToString();
string TheImageText = reader2[2].ToString();
string TheImageName = reader2[3].ToString();
string TheAlternatetext = reader2[4].ToString();
string TheHRef = reader2[5].ToString();
values.Add(new PositionData("", "", "AdBox", "TheImage" +
LCounter.ToString(), TheImageName, TheAlternatetext, TheImageText,
Repeater2.DataSource = values;

LLabel = "<\\div>" ;
values.Add(new PositionData(LLabel, "", "","", "", "", "", ""));



May 28 '07 #1
0 1659

This thread has been closed and replies have been disabled. Please start a new discussion.

Similar topics

by: cjl | last post by:
OK: I am really scratching my head over a preload / image swapping problem, so I started conducting experiments: http://www.saintrays.net/experiment1.html...
by: karthikeyan | last post by:
Hi, I am having some problems hosting my website. Everything works fine in my local machine but when I upload to propduction server, my images won't load properly. I have my state configuration...
by: bessington | last post by:
hey all, i'm having a rather bizarre problem.. the image tag i have declared in my xhtml is not showing in safari / konqueror but showing just fine in Firefox, IE, Opera... this is a complete...
by: Rajesh | last post by:
Hi all, Im gonna display a list of images in an aspx page from sql server Db.Each image has a link.When someone clicks the image i want the width and size of the image to be displayed at the...
by: Mark Szlazak | last post by:
The following page simulates a pool cue and cue ball: http://members.aol.com/myscript/cue.html Mouse cursor position around the cue ball determines where a roll-over of 179 pool cue images is...
by: needin4mation | last post by:
Hi, I have an Access 2002 - 2003 database. I am using Access 2003. Whenever I link an image all it shows is the filename. Not the image. Other versions of Access can link the image just fine. ...
by: Svein Erik | last post by:
I'm developing an application in C#.NET 2005. The app is going to have an image with a specific size, let's say 800x600 px, this is a map of a go-cart lane. And on top of this image i'm going to...
by: Gabriella | last post by:
Hi, I have the CSS class below, and the image (pro.gif) is not showing on my page. It is showing ONLY where's some text in the div, but all I need is the image itself. ..pro {background-image:...
by: Sandeep Singh Sekhon | last post by:
I am developing an application in ASP.NET 1.1. on one page I allow the user to upload and delete the files to the server. When I delete the file, I physically delete the file from the location....
by: Switch4Mac | last post by:
Hi, I want to insert an ad in my MasterPage. So in the MasterPage, I have this piece of code: <asp:Image ID="GatesAd" runat="server"...
by: isladogs | last post by:
The next Access Europe meeting will be on Wednesday 2 August 2023 starting at 18:00 UK time (6PM UTC+1) and finishing at about 19:15 (7.15PM) The start time is equivalent to 19:00 (7PM) in Central...
by: linyimin | last post by:
Spring Startup Analyzer generates an interactive Spring application startup report that lets you understand what contributes to the application startup time and helps to optimize it. Support for...
by: erikbower65 | last post by:
Here's a concise step-by-step guide for manually installing IntelliJ IDEA: 1. Download: Visit the official JetBrains website and download the IntelliJ IDEA Community or Ultimate edition based on...
by: kcodez | last post by:
As a H5 game development enthusiast, I recently wrote a very interesting little game - Toy Claw ((http://claw.kjeek.com/))。Here I will summarize and share the development experience here, and hope it...
by: Taofi | last post by:
I try to insert a new record but the error message says the number of query names and destination fields are not the same This are my field names ID, Budgeted, Actual, Status and Differences ...
by: Rina0 | last post by:
I am looking for a Python code to find the longest common subsequence of two strings. I found this blog post that describes the length of longest common subsequence problem and provides a solution in...
by: DJRhino | last post by:
Private Sub CboDrawingID_BeforeUpdate(Cancel As Integer) If = 310029923 Or 310030138 Or 310030152 Or 310030346 Or 310030348 Or _ 310030356 Or 310030359 Or 310030362 Or...
by: lllomh | last post by:
How does React native implement an English player?
by: DJRhino | last post by:
Was curious if anyone else was having this same issue or not.... I was just Up/Down graded to windows 11 and now my access combo boxes are not acting right. With win 10 I could start typing...

By using Bytes.com and it's services, you agree to our Privacy Policy and Terms of Use.

To disable or enable advertisements and analytics tracking please visit the manage ads & tracking page.