Identifying the selected image server side

3 posts, 0 answers
  1. Todd A
    Todd A avatar
    43 posts
    Member since:
    Sep 2009

    Posted 22 Oct 2014 Link to this post

    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. Eyup
    Admin
    Eyup avatar
    3007 posts

    Posted 27 Oct 2014 Link to this post

    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.

     
  3. UI for ASP.NET Ajax is Ready for VS 2017
  4. Todd A
    Todd A avatar
    43 posts
    Member since:
    Sep 2009

    Posted 27 Oct 2014 in reply to Eyup Link to this post

    Works great! Thanks!
Back to Top