Wednesday, March 28, 2012

Links on a SlideshowExtender Image

Good morning!

I have a SlideShowExtender control on my site and it's working great. However, I was wondering if anyone knows how I can make each image a link to a different page, just like MSN.com is able to do with its slideshow. I'm not sure if the SlideShowExtender extends ImageButton, but I'd like to keep the images and the target links out of the codebehind if I could.

Thanks for your help.

Erik

Hi,

You can do it like this:

<asp:Image ID="Image1" runat="server" onclick="javascript:window.open(this.src);"
Height="300"
Style="border: 1px solid black;width:auto;cursor:hand"
ImageUrl="~/SlideShow/images/Blue hills.jpg"
AlternateText="Blue Hills image" />
<asp:Label runat="Server" ID="imageLabel1"/><br /><br />
<asp:Button runat="Server" ID="prevButton" Text="Prev" Font-Size="Larger" />
<asp:Button runat="Server" ID="playButton" Text="Play" Font-Size="Larger" />
<asp:Button runat="Server" ID="nextButton" Text="Next" Font-Size="Larger" />
<ajaxToolkit:SlideShowExtender ID="slideshowextend1" runat="server"
TargetControlID="Image1"
SlideShowServiceMethod="GetSlides"
AutoPlay="true"
ImageDescriptionLabelID="imageLabel1"
NextButtonID="nextButton"
PlayButtonText="Play"
StopButtonText="Stop"
PreviousButtonID="prevButton"
PlayButtonID="playButton"
Loop="true" />

Best Regards,

No comments:

Post a Comment