This is a migrated thread and some comments may be shown as answers.

ClientSide Imagefilename and Imageurl

1 Answer 35 Views
Rotator
This is a migrated thread and some comments may be shown as answers.
Henrik Stensgaard
Top achievements
Rank 1
Henrik Stensgaard asked on 15 Feb 2009, 05:04 PM
Hi

Is there a way to get the imagefilename and url of the image clicked on using clientside Javascript? 

1 Answer, 1 is accepted

Sort by
0
Accepted
Fiko
Telerik team
answered on 16 Feb 2009, 03:50 PM
Hello Henrik,

You could find the html element that wraps the items in the item template. You should attach a handler to the OnClientClick event of the RadRotator contro, then inside this handler you could follow this logic: (using the second parameter of the handler - arg ) :

  • Get the reference to the item that has been currently clicked on e.g :
    var clickedItem = arg.get_item(); 
  •  get the reference  to the html item that wraps the item content ( the alert(htmlElement.innerHTML); function will print the content of this element ) :
    var htmlElement = clickedItem.get_element(); // LI element
  • proceed with this element as a standard html element and find its child elements, depending of your ItemTemplate construction.

I hope this helps.

Greetings,
Fiko
the Telerik team

Instantly find answers to your questions on the new Telerik Support Portal.
Check out the tips for optimizing your support resource searches.
Tags
Rotator
Asked by
Henrik Stensgaard
Top achievements
Rank 1
Answers by
Fiko
Telerik team
Share this question
or