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

Identifying the selected image server side

2 Answers 113 Views
ImageGallery
This is a migrated thread and some comments may be shown as answers.
Todd A
Top achievements
Rank 1
Todd A asked on 22 Oct 2014, 06:36 PM
I am displaying a number of images in thumbnail area with DisplayAreaMode="ToolTip".

Then a user clicks an image, it selects the thumbnail and shows the tooltip with a larger image.  Works great!

When the tool tip goes away, the thumbnail is still selected -- how would I get the selected Thumbnail on the server side?

Thanks,
Todd.

2 Answers, 1 is accepted

Sort by
0
Eyup
Telerik team
answered on 27 Oct 2014, 02:01 PM
Hello Todd,

You can achieve the requested functionality using the following approach:
<telerik:RadImageGallery ... >
    <ClientSettings>
        <ClientEvents OnNavigating="imageNavigate" />
    </ClientSettings>
</telerik:RadImageGallery>
<asp:HiddenField ID="HiddenField1" runat="server" />
JavaScript:
function imageNavigate(sender, args) {
    $get('<%= HiddenField1.ClientID %>').value = args.get_itemIndex();
}
C#:
protected void Button1_Click(object sender, EventArgs e)
{
    int index = 0;
    if (int.TryParse(HiddenField1.Value, out index))
    {
        ImageGalleryItem item = RadImageGallery1.Items[index] as ImageGalleryItem;
        string value = item.ImageUrl;
        // execute custom logic
    }
}

Hope this helps. Please give it a try and let me know if it works for you.

Regards,
Eyup
Telerik
 

Check out the Telerik Platform - the only platform that combines a rich set of UI tools with powerful cloud services to develop web, hybrid and native mobile apps.

 
0
Todd A
Top achievements
Rank 1
answered on 27 Oct 2014, 06:49 PM
Works great! Thanks!
Tags
ImageGallery
Asked by
Todd A
Top achievements
Rank 1
Answers by
Eyup
Telerik team
Todd A
Top achievements
Rank 1
Share this question
or