Feedback Form

Monday, February 04, 2008

SlideShowExtender Set Current Image Index, Src

I wanted to set the SlideShowExtender current image, i found just one good way to do so using simple java script code

1- Add the SlideShowExtender:

<cc1:SlideShowExtender BehaviorID="behaviorID" ID="SlideShowExtender1" runat="server"
SlideShowServiceMethod="GetSlides" PlayInterval="9000" TargetControlID="imgScreen"
UseContextKey="True" AutoPlay="true" Loop="true">
</cc1:SlideShowExtender>


2- Add the following java script code:

function changeImage(imgUrl, imageIndex){
slider1 = $find("behaviorID");
slider1._currentIndex = imageIndex-1;
slider1.setCurrentImage = imgUrl;
}

kick it on DotNetKicks.com

2 comments:

Anonymous said...

It's not working like that, you don't need to set the image url, only you change the current image index and call the setCurrentImage function to update the image at the new index just set, you're using setCurrentImage as a property while it's a function that takes no parameters.

function changeImage(imageIndex){
slider1 = $find("behaviorID");
slider1._currentIndex = imageIndex;
slider1.setCurrentImage();
}

Anonymous said...

Thank you! It works...