using a variable to display the number of images

G

Guest

Hello All

I am not sure if this is the right forum or not so, my apologies before hand
if I am guilty. I have a C# application that has a property retrieving value
(int) from my database. I would like to use this value as the number of
images to dispaly in the page. I have two images (image1.gif and Image2.gif)
in my c:\image folder on my file system. If the value is zero(0) image1.gif
will be displayed; if the value is 1 or greater, image2.gif will be displayed
the number of times the value is equal to. For clarification if the value is
3, three image2.gif files will be displayed on the page. I hope I was clear
about my requirements.

Thanks In Advance for you help on this.
 
G

Guest

I thought this board could use this thread. I got an answer to my question so
here it is for others who may come across this problem.

Thanks both of you, both suggestions help me out a bunch. Actually I placed
the image(s) in a panel contol to respresent a container of sort. Here is my
code if someone else should browse the topic another day.

if (NumberSmileysDisplayed <= 0)
{
Image vImage = new Image();
vImage.ImageUrl = "images/gsmiley.gif";
cFacePanel.Controls.Add(vImage);
}
else
{
for(int i=1;i<=(NumberSmileysDisplayed);i++)
{
Image vImage = new System.Web.UI.WebControls.Image();
vImage.ImageUrl = "images/bfrown.gif";
cFacePanel.Controls.Add(vImage);
}
}

Hope it benefit someone out there!!!!
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Top