How to get the rad rotator clicked items in client side

5 posts, 1 answers
  1. ras
    ras avatar
    12 posts
    Member since:
    Aug 2012

    Posted 17 Dec 2012 Link to this post

     I have a rad rotator. I want to show a tooltip On radrotator OnClientItemClicked event
    . I also Want to get the text of lblDescription in to tootip's Label1. . Is  there any way to do this in client side.My code is Here.. Thanks in Advance

    <telerik:RadRotator ID="RadRotator1" runat="server" FrameDuration="1"
                         ScrollDirection="up" Height="140px"  ScrollDuration="2000"  OnClientItemClicked="itemclicked"
                        Width="100%"   >

                        <ItemTemplate>
          
                      
                            <asp:LinkButton ID="LinkButton1" runat="server" Font-Size="Small" Font-Italic="False" ForeColor="#0033CC">
                                                 <%#  Eval("Title")%></asp:LinkButton>
                                  <asp:Label ID="lblDescription" runat="server" ><%# Eval("Description")%>                  </asp:Label>

                        </ItemTemplate>
        </telerik:RadRotator>


         <telerik:RadToolTip runat="server" ID="RadToolTip2"  ShowEvent="FromCode"  ShowDelay="0" TargetControlID="LinkButton1" Animation="Slide"
                            HideEvent="ManualClose" Width="300px" RelativeTo="Element" Position="MiddleRight" >
                            
                              <asp:Label ID="Label2" runat="server" >             </asp:Label>

                            </telerik:RadToolTip>
  2. Answer
    Princy
    Princy avatar
    17421 posts
    Member since:
    Mar 2007

    Posted 18 Dec 2012 Link to this post

    Hi,

    Try the following code snippet to achieve your scenario.

    ASPX:
    <telerik:RadRotator ID="RadRotator1" runat="server" FrameDuration="1" ScrollDirection="up" OnClientItemClicked="itemclicked" Height="140px" ScrollDuration="2000" Width="100%" DataSourceID="SqlDataSource2">
        <ItemTemplate>
            <asp:LinkButton ID="LinkButton1" runat="server" Font-Size="Small" Font-Italic="False"
                OnClientClick="return false;" ForeColor="#0033CC"><%#  Eval("Title")%></asp:LinkButton>
            <asp:Label ID="lblDescription" runat="server"><%# Eval("Description")%></asp:Label>
        </ItemTemplate>
    </telerik:RadRotator>
    <telerik:RadToolTip runat="server" ID="RadToolTip2" ShowEvent="FromCode" ShowDelay="0" TargetControlID="LinkButton1" Animation="Slide" HideEvent="ManualClose" Width="300px" RelativeTo="Element" Position="MiddleRight">
        <asp:Label ID="Label2" runat="server"></asp:Label>
    </telerik:RadToolTip>

    JS:
    <script type="text/javascript">
        function itemclicked(sender, args) {
            var rotatorItem = args.get_item();
            var itemElem = rotatorItem.get_element();
            var wrapper = itemElem.firstChild;
            var lblDescription = $get(wrapper.id + "_" + "lblDescription", wrapper);
            var text = lblDescription.innerHTML;
            var tooltip = $find("<%= RadToolTip2.ClientID %>");
            var lbl = document.getElementById("<%= Label2.ClientID %>");
            lbl.innerHTML = text;
            tooltip.show();
        }
    </script>

    Hope this helps.

    Regards,
    Princy.
  3. UI for ASP.NET Ajax is Ready for VS 2017
  4. ras
    ras avatar
    12 posts
    Member since:
    Aug 2012

    Posted 19 Dec 2012 Link to this post


    Thanks Princy.. Thank You Very Much. It Worked for me really fine. superb.
  5. Manu
    Manu avatar
    24 posts
    Member since:
    Aug 2015

    Posted 25 Feb Link to this post

    hi,

    i have created radrotator server side and i given e.item.tooltip=some text, its working fine. but i want to access this tooltip value in client side event "OnClientItemClicked". can anyone help for this?

    Thanks in advance.

  6. Stamo Gochev
    Admin
    Stamo Gochev avatar
    157 posts

    Posted 01 Mar Link to this post

    Hi Manu,

    You can have a look at the client-side API of RadToolTip and use the get_text() method to achieve that.

    Regards,
    Stamo Gochev
    Telerik
    Do you want to have your say when we set our development plans? Do you want to know when a feature you care about is added or when a bug fixed? Explore the Telerik Feedback Portal and vote to affect the priority of the items
Back to Top
UI for ASP.NET Ajax is Ready for VS 2017