Help required with repeater control id

Discussion in 'General Computer Support' started by MarkSci, Dec 3, 2009.

  1. MarkSci

    MarkSci

    Joined:
    Dec 3, 2009
    Messages:
    2
    Hi everyone,

    I'm new to asp.net and have a repeater control which contains a Hyperlink control and a large sized image. Underneath this I would like to place more hyperlink controls containing thumbnails so that when a user clicks on a thumbnail, the large image is replaced with the thumbnail image. The problem is that I don't seem to be able to create a unique id for the large image so that when the thumbnail's click event is triggered, the codebehind can use the findcontrol method to replace the large image's url. Here is the code.

    <td class="ImageCell" rowspan="4">
    <asp:HyperLink ID="myImg" runat="server" NavigateUrl='<%# GetLargeImage(convert.tostring(Eval("Image_1"))) %>'
    imageurl='<%# FormatImage(convert.tostring(Eval("Image_1"))) %>' />
    <br /><br />
    <asp:HyperLink ID="myImgThumb" CssClass="ImageThumb" runat="server"
    imageurl='<%# FormatImageThumb(convert.tostring(Eval("Image_1"))) %>'
    NavigateUrl='<%# ReplaceImage(Eval("Image_1")) %>' />
    </td>

    I've done this before with javascript when there is just a single large image (id="LargeImage") by passing in the new image url to reset the large image's src parameter like so:

    function swapPhoto(strBigPhoto)
    {
    document.images.LargePicture.src = strBigPhoto;
    }

    This is driving me nuts! Whenever I try to set the ID of the large picture to something recognisable (such as my database id), I get a "The ID property of a control can only be set using the ID attribute in the tag and a simple value. " error.

    Please help!!!
     
    MarkSci, Dec 3, 2009
    #1
    1. Advertising

  2. MarkSci

    MarkSci

    Joined:
    Dec 3, 2009
    Messages:
    2
    Solution!

    I found the solution for this. Basically I needed a different control. I used an imagebutton control for the thumbnails which provides a CommandArgument, which can then be evaluated in the ItemCommand event (in my case which is in a repeater) to set the larger image. Simples!
     
    MarkSci, Dec 8, 2009
    #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. tkjjkt@yahoo.co.uk

    Cisco 350 AP 12.05 as repeater help

    tkjjkt@yahoo.co.uk, Dec 29, 2005, in forum: Cisco
    Replies:
    7
    Views:
    3,000
    tkjjkt@yahoo.co.uk
    Dec 29, 2005
  2. FattyMcGee
    Replies:
    0
    Views:
    906
    FattyMcGee
    Mar 30, 2005
  3. Mike
    Replies:
    0
    Views:
    3,680
  4. Upmanyu
    Replies:
    0
    Views:
    946
    Upmanyu
    Mar 27, 2008
  5. embalse

    DAP-1353 Access Point as Repeater with DIR-655 HELP!!

    embalse, Oct 8, 2008, in forum: Wireless Networking
    Replies:
    0
    Views:
    2,646
    embalse
    Oct 8, 2008
Loading...

Share This Page