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

Changing tooltip content dynamically

2 Answers 1309 Views
ToolTip
This is a migrated thread and some comments may be shown as answers.
Kelly
Top achievements
Rank 1
Kelly asked on 02 Aug 2013, 05:42 PM
I'm sure this is an easy answer but I've looked high and low and cannot find the answer. How do I dynmically change the content of a tooltip? I'm using the following code:

<div style="text-align:center;width:50%;margin:5px auto" class="inputbox numberSelected" id="ttAnchor"></div>
                        @(Html.Kendo().Tooltip()
                            .Callout(false)
                            .For("#ttAnchor")
                            .Position(TooltipPosition.Right)
                            .Width(200)
                            .Events(events => events.Show(
                                @<text>
                                    function(e){
                                        e.content = "test";
                                    }
                                </text>
                                ))
                        )

e.content does not seem to work. I'm sure I'm just missing a key word somewhere. I do want the content to change everytime the tooltip is shown.

2 Answers, 1 is accepted

Sort by
0
Accepted
Rosen
Telerik team
answered on 05 Aug 2013, 03:35 PM
Hi Paul,

You could use the ContentHandler method to attached a function in which you can handle the content creation:

@(Html.Kendo().Tooltip()
        .For("#container")
        .ContentHandler("content")
 )
 
<script type="text/javascript">
 
    function content(e) {
        return "some content";
    }
</script>

Regards,
Rosen
Telerik
Join us on our journey to create the world's most complete HTML 5 UI Framework - download Kendo UI now!
0
Kelly
Top achievements
Rank 1
answered on 05 Aug 2013, 08:26 PM
I had been populating my content using the content handler but it only updated on the page load. I've since added a refresh call on the show and that seems to work fine.
Tags
ToolTip
Asked by
Kelly
Top achievements
Rank 1
Answers by
Rosen
Telerik team
Kelly
Top achievements
Rank 1
Share this question
or