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

How to get the rad rotator clicked items in client side

4 Answers 153 Views
Rotator
This is a migrated thread and some comments may be shown as answers.
ras
Top achievements
Rank 1
ras asked on 17 Dec 2012, 06:44 AM
 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>

4 Answers, 1 is accepted

Sort by
0
Accepted
Princy
Top achievements
Rank 2
answered on 18 Dec 2012, 12:08 PM
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.
0
ras
Top achievements
Rank 1
answered on 19 Dec 2012, 10:32 AM

Thanks Princy.. Thank You Very Much. It Worked for me really fine. superb.
0
Bhavya
Top achievements
Rank 1
answered on 25 Feb 2016, 07:20 AM

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.

0
Stamo Gochev
Telerik team
answered on 01 Mar 2016, 08:42 AM
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
Tags
Rotator
Asked by
ras
Top achievements
Rank 1
Answers by
Princy
Top achievements
Rank 2
ras
Top achievements
Rank 1
Bhavya
Top achievements
Rank 1
Stamo Gochev
Telerik team
Share this question
or