Professional Web Applications Themes

Multiple instances of a control? <img> ?? - ASP.NET Web Services

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 ...

  1. #1

    Default Multiple instances of a control? <img> ??

    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 Guest

  2. #2

    Default Re: Multiple instances of a control? <img> ??

    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: [url]http://weblogs.asp.net/jan[/url]
    "Kristoffer Arfvidson" <kristofferarfvidson.se> schreef in bericht

    news:Owi5NM1xDHA.1396TK2MSFTNGP10.phx.gbl...
    > 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 Guest

Similar Threads

  1. Multiple DW IDE Instances
    By kscap in forum Macromedia Exchange Dreamweaver Extensions
    Replies: 5
    Last Post: October 26th, 01:40 PM
  2. Replies: 2
    Last Post: November 24th, 11:38 PM
  3. Replies: 1
    Last Post: July 30th, 02:31 PM
  4. Draging multiple instances of multiple objects
    By equinox007 webforumsuser@macromedia.com in forum Macromedia Flash Actionscript
    Replies: 2
    Last Post: January 23rd, 01:31 AM
  5. Multiple Composite Control Instances
    By Russ in forum ASP.NET Building Controls
    Replies: 8
    Last Post: September 18th, 08:30 AM

Bookmarks

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •  

1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 75 76 77 78 79 80 81 82 83 84 85 86 87 88 89 90 91 92 93 94 95 96 97 98 99 100 101 102 103 104 105 106 107 108 109 110 111 112 113 114 115 116 117 118 119 120 121 122 123 124 125 126 127 128 129 130 131 132 133 134 135 136 137 138 139