[CLOSED] Help with ToolTip using Razor

  1. #1

    [CLOSED] Help with ToolTip using Razor

    Hi

    There must be something very basic that I'm missing but I can't seem to get a ToolTip to work.

    This is what I've tried. I'm expecting "v1.0.36" to be displayed when I hover over the control with the mouse, but nothing doing:

    <!DOCTYPE html>
    <html>
    <head>
        <title></title>
            <script>
            </script>
    </head>
    <body>
        @Html.X().ResourceManager().ScriptMode(Ext.Net.ScriptMode.Debug).SourceFormatting(true)
        @(Html.X().FormPanel().ID("FormPanel").Layout(LayoutType.Anchor)
            .Items(
                Html.X().TextField().ID("TestControl").Margin(50).Width(100).Height(100).Text("Test")
            )
            .Bin(Html.X().ToolTip().Target("TestControl").Html("v1.0.36"))
        )
    </body>
    </html>
    using Ext.Net;
    using Ext.Net.MVC;
    using System;
    using System.Collections.Generic;
    using System.Linq;
    using System.Web.Mvc;
    
    namespace ExtSandpit.Controllers
    {
        public class HomeController : Controller
        {
            public ActionResult Index()
            {
                return View();
            }
        }
    }
    Last edited by Daniil; Sep 18, 2015 at 1:19 PM. Reason: [CLOSED]
  2. #2
    Hi Jeff,

    I think the ToolTip is being created and targeted (according to .Target("TestControl")) before the TestControl is created. Therefore, the ToolTip is targeted to nothing.

    Here is a possible approach to get it working.
    @(Html.X().FormPanel()
        .Items(
            Html.X().TextField()
                .Margin(50)
                .Width(100)
                .Height(100)
                .Text("Test")
                .Listeners(events =>
                {
                    events.AfterRender.Handler = "this.ownerCt.getBinComponent(0).setTarget(this);";
                })
        )
        .Bin(Html.X().ToolTip().Html("v1.0.36"))
    )
    Here is another approach.
    @(Html.X().FormPanel()
        .Items(
            Html.X().TextField()
                .Margin(50)
                .Width(100)
                .Height(100)
                .Text("Test")
                .ToolTips(tt => tt.Add(Html.X().ToolTip().Html("v1.0.36")))
                
        )
    )
  3. #3
    Thanks Daniil

    The second option seems simpler and works well. So I've adopted that.

    Thanks again.

    Jeff

Similar Threads

  1. Replies: 3
    Last Post: Jun 23, 2015, 7:35 PM
  2. [CLOSED] [RAZOR] DraggablePanelConfig doesn't have StartDrag in Razor
    By UnifyEducation in forum 2.x Premium Help
    Replies: 2
    Last Post: Sep 28, 2012, 3:37 PM
  3. [CLOSED] [Razor] HyperLink Text in Razor
    By UnifyEducation in forum 2.x Premium Help
    Replies: 1
    Last Post: Jun 20, 2012, 1:16 PM
  4. [CLOSED] [Razor] Add GridView to GridPanel in razor
    By boris in forum 2.x Premium Help
    Replies: 3
    Last Post: May 09, 2012, 5:23 PM
  5. [CLOSED] [Razor] Setup Auto load panel in razor
    By UnifyEducation in forum 2.x Premium Help
    Replies: 1
    Last Post: Apr 27, 2012, 11:54 AM

Tags for this Thread

Posting Permissions