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" >
<asp:ImageButton ID="btnHomePage" runat="server" ImageUrl='<%# "images/" & Eval("hpi_image")%>' AlternateText='<%# Eval("hpi_URL") %>' OnClick="btnHomePage_Click"/>
<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">
And here is the Click event from the code-behind:
Protected Sub btnHomePage_Click(sender As Object, e As System.Web.UI.ImageClickEventArgs)
Very simple, and it should work. But it doesn't and it's driving me crazy !!