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

tooltip in template not loading properly

2 Answers 122 Views
ToolTip
This is a migrated thread and some comments may be shown as answers.
Yuhua
Top achievements
Rank 1
Yuhua asked on 05 Jun 2013, 08:37 PM
 want to include a tooltip in template.

<script id="filter-panel-tpl" type="text/x-kendo-template">
<div>
    # if (Type == Single){ #
        <div class="hight-light-box" >
            <div id="name-#= Id#-@ViewBag.Uid" class="small-size-icon icon-margin-right-5" style="float:right;"></div>
            #= Name #
        </div>
    # }else{ #
        <div class="hight-light-box" >
            <div id="name-#= Id#-@ViewBag.Uid" class="small-size-icon edit-icon icon-margin-right-5" style="float:right;" data-bind="click: onEdit"></div>
            #= Name #
        </div>
    # } #
    @(Html.Kendo().Tooltip()
                .For("#name-#= Id#-" + ViewBag.Uid)
                .Width(300)
                .Height(450)
======>  .LoadContentFrom("Index", "Search", new { searchType ="#=Name#" })
                .Position(TooltipPosition.Right)
                .ShowOn(TooltipShowOnEvent.Click)
                .AutoHide(false)
                .ToClientTemplate()
         )
</div>
</script>

In Search Controller, I set a break point in Index(string name). The value for name is "#=Name#", not the value of "Name" field from data model. The rendering for <div> part is working though. Can someone please take a look at this?

Thanks.

2 Answers, 1 is accepted

Sort by
0
Rosen
Telerik team
answered on 06 Jun 2013, 07:09 AM
Hi Yuhua,

Setting the route value as template expression is not supported in the current version of the Tooltip for ASP.NET MVC. However, we will add support for this in the next version of the Tooltip.

Meanwhile, you could use the requestStart event to pass the route value. Similar to the following:

<script id="filter-panel-tpl" type="text/x-kendo-template">
<div>  
 
     //...........
 
    @(Html.Kendo().Tooltip()
                .For("#name-#= Id#-" + ViewBag.Uid)
                .Width(300)
                .Height(450)
                .LoadContentFrom("Index", "Search")
                .Events(events => events.RequestStart(@<text>
                    function(e) {
                        e.options.data = {
                            searchType: '#=Name#'
                        };
                    }
                </text>))
                .Position(TooltipPosition.Right)
                .ShowOn(TooltipShowOnEvent.Click)
                .AutoHide(false)
                .ToClientTemplate()
         )
</div>
</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
Yuhua
Top achievements
Rank 1
answered on 06 Jun 2013, 03:43 PM
Thank you very much for your solution. It works well.
Tags
ToolTip
Asked by
Yuhua
Top achievements
Rank 1
Answers by
Rosen
Telerik team
Yuhua
Top achievements
Rank 1
Share this question
or