Velocity Reviews - Computer Hardware Reviews

Velocity Reviews > General Computer Discussion > General Computer Support > Help required with repeater control id

Reply
Thread Tools

Help required with repeater control id

 
 
MarkSci MarkSci is offline
Junior Member
Join Date: Dec 2009
Posts: 2
 
      12-03-2009
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!!!
 
Reply With Quote
 
 
 
 
MarkSci MarkSci is offline
Junior Member
Join Date: Dec 2009
Posts: 2
 
      12-08-2009
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!
 
Reply With Quote
 
 
 
Reply

Thread Tools

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is On
HTML code is Off
Trackbacks are On
Pingbacks are On
Refbacks are Off


Similar Threads
Thread Thread Starter Forum Replies Last Post
Help Required in Repeater Control. deepak.surana@gmail.com ASP .Net Building Controls 1 04-09-2006 04:30 PM
Repeater Using Javascript Referencing a Column in the Repeater rwoo_98@yahoo.com ASP .Net 0 02-26-2005 05:02 PM
Repeater control with nested repeater chris.reed@digus.com ASP .Net 0 02-11-2005 05:10 PM
ASP.Net Checkbox control nested within repeater control...HELP!! Brian Miller ASP .Net Web Controls 6 11-18-2004 07:34 AM
Please HELP! Need to access textbox control values within a repeater control Darren Smith ASP .Net 5 05-10-2004 03:37 PM



Advertisments