tooltip in template not loading properly

3 posts, 1 answers
  1. Answer
    Yuhua
    Yuhua avatar
    4 posts
    Member since:
    May 2013

    Posted 05 Jun 2013 Link to this post

     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. Rosen
    Admin
    Rosen avatar
    3237 posts

    Posted 06 Jun 2013 Link to this post

    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!
  3. Kendo UI is VS 2017 Ready
  4. Yuhua
    Yuhua avatar
    4 posts
    Member since:
    May 2013

    Posted 06 Jun 2013 Link to this post

    Thank you very much for your solution. It works well.
Back to Top