Multiple instances of a control? <img> ??

Discussion in 'ASP .Net Web Services' started by Kristoffer Arfvidson, Dec 20, 2003.

  1. 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
    Kristoffer Arfvidson, Dec 20, 2003
    #1
    1. Advertising

  2. Kristoffer Arfvidson

    Jan Tielens Guest

    Kristoffer

    I think you'd better post your question in the ASP.NET newsgroups, this one
    is for Webservices. I guess there are more people who can help you out. ;-)

    --
    Greetz,
    Jan
    __________________________________
    Read my weblog: http://weblogs.asp.net/jan
    "Kristoffer Arfvidson" <> schreef in bericht

    news:...
    > 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
    >
    >
    Jan Tielens, Dec 21, 2003
    #2
    1. Advertising

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

It takes just 2 minutes to sign up (and it's free!). Just click the sign up button to choose a username and then you can ask your own questions on the forum.
Similar Threads
  1. news.austin.rr.com

    how to download img from html img tag

    news.austin.rr.com, Apr 27, 2005, in forum: ASP .Net
    Replies:
    2
    Views:
    494
    Steve C. Orr [MVP, MCSD]
    Apr 27, 2005
  2. Philipp Lenssen

    Problem: <img></img>

    Philipp Lenssen, Jun 27, 2005, in forum: XML
    Replies:
    15
    Views:
    730
    David Håsäther
    Jul 3, 2005
  3. John Wohlbier
    Replies:
    2
    Views:
    347
    Josiah Carlson
    Feb 22, 2004
  4. Jopek
    Replies:
    7
    Views:
    379
    dorayme
    Apr 26, 2009
  5. Replies:
    7
    Views:
    158
    Tad McClellan
    Jun 22, 2006
Loading...

Share This Page