Multiple instances of a control? <img> ??

  • Thread starter Kristoffer Arfvidson
  • Start date
K

Kristoffer Arfvidson

Is it possible to have multiple instances of a control and still access all
of them in codebehind?

For example, I need to be able to change an image location on a frequent
basis...
so, I decided to use <asp:image id="img_tomgif1" runat="server" enabled=true
width="1" height="2"/>
ok...

and, I put the code that changes image in the codebehind page eg...

public img_tomgif1 as image
img_tomgif1.ImageUrl=http://IMAGEURL

now, so far so good, now comes the problem, this image is repeated thruout
my homepage...
so, at first I started to place img_tomgif1 img_tomgif2 and so on, but this
soon became a mess in my code, so I decided I wanted to make multiple
instances of the image instead...
(img_tomgif (0), (1), (2))
but, since I put an id tag on my image it dosn´t work, because asp.net
requires the id tag to be unique, but how do I access the image from
codebehind if I don´t make an Id-tag?
is there a way of making multiple instances of the image and still refer to
it as a single image on the codebehind page?
(Or similair option, I think you understand what I want do to) :)

Yours: Kristoffer
 

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

Members online

No members online now.

Forum statistics

Threads
473,995
Messages
2,570,228
Members
46,818
Latest member
SapanaCarpetStudio

Latest Threads

Top