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

RadRotator ignoring unique target URLs

4 Answers 77 Views
Rotator
This is a migrated thread and some comments may be shown as answers.
Bruce
Top achievements
Rank 1
Bruce asked on 14 Mar 2012, 09:14 PM
I am using a RadRotator control to display a series of images, and each image has a unique target URL that the user is to be redirected to when clicked.

What I encountering is that the ImageButton contains the properties of the last image in the Rotator. When I look at the sender object in the code-behind, the ImageURL and AlternateText property are set to the last image loaded into the Rotator, not the values of the image I clicked.

How can I get this to work ?? I was using a asp:Hyperlink control initially in the RadRotator, but the same problem was occuring.


Here is my code:


                        <telerik:RadRotator ID="RadRotator1" runat="server" DataSourceID="SqlDataSourceHomeImages" FrameDuration="4000" RotatorType="AutomaticAdvance"  >
                            <ItemTemplate>
                                    <asp:ImageButton ID="btnHomePage" runat="server" ImageUrl='<%# "images/" & Eval("hpi_image")%>'  AlternateText='<%# Eval("hpi_URL") %>' OnClick="btnHomePage_Click"/>
                                      </ItemTemplate>
                        </telerik:RadRotator>

                        <asp:SqlDataSource ID="SqlDataSourceHomeImages" runat="server" ConnectionString="<%$ ConnectionStrings:WebDB_string.com%>"
                                SelectCommand="SELECT hpi_image, hpi_URL, hpi_external FROM tbl_HomeImages WHERE hpi_show_on_web = 'True' ORDER BY hpi_sort_order">
                        </asp:SqlDataSource>

And here is the Click event from the code-behind:

   Protected Sub btnHomePage_Click(sender As Object, e As System.Web.UI.ImageClickEventArgs)

        Response.Redirect(sender.AlternateText)

    End Sub

Very simple, and it should work. But it doesn't and it's driving me crazy !!

Thanks !

Bruce

4 Answers, 1 is accepted

Sort by
0
Accepted
Slav
Telerik team
answered on 19 Mar 2012, 02:47 PM
Hi Bruce,

Please check the attached sample page and verify if there are differences in the configuration, something that I am missing in order to reproduce the problem.

Note that you can achieve the same effect by placing an ASP Image control instead of an ImageButton in the RadRotator's items and handling its event OnItemClick. This way you can also reference the clicked item and its content.

The steps, listed in the help article How to configure RadRotator, are recommended for configuring the rotator control properly, as I noticed that you have not specified size for the RadRotator and its items.

If you are still having difficulties after examining the provided information, please describe the changes that should be made to the attached page so that the issue can be reproduced or provide a reliable steps for recreating your problem so that I can examine it locally.

Kind regards,
Slav
the Telerik team
If you want to get updates on new releases, tips and tricks and sneak peeks at our product labs directly from the developers working on the RadControls for ASP.NET AJAX, subscribe to their blog feed now.
0
Bruce
Top achievements
Rank 1
answered on 19 Mar 2012, 03:17 PM
Thank you, thank you, thank you !!!

The example was exactly what I needed. Not sure why it was working previously, but it's working now.

Thanks for your help !!

Bruce
0
Bruce
Top achievements
Rank 1
answered on 19 Mar 2012, 03:54 PM
Uh-oh. I spoke to soon.

It is working perfectly in IE, Firefox and Chrome, but the images are not rotating in Safari. Any ideas why this would be happening and how to correct it ??
0
Bruce
Top achievements
Rank 1
answered on 19 Mar 2012, 04:16 PM
I had set the Height and Width properties, but not the ItemHeight and ItemWidth. Once those were set, it rotated correctly in all browsers.
Tags
Rotator
Asked by
Bruce
Top achievements
Rank 1
Answers by
Slav
Telerik team
Bruce
Top achievements
Rank 1
Share this question
or