[CLOSED] Adding ToolTip to panel in codebehind

  1. #1

    [CLOSED] Adding ToolTip to panel in codebehind

    I'm trying to conditionally add a tooltip to a panel (inside of a tabPanel) in codebehind. Though I get no errors I don't get the tooltip either. I am also changing the icon of the panel and that part works. The page is fairly complex so only partial code below:

    <ext:FitLayout ID="FitLayout1" runat="server">
        <Items>
            <ext:Panel ID="MainPanel" runat="server" Border="false" Layout="FitLayout">
                <Items>
                    <ext:TabPanel ID="TabPanel" runat="server" ActiveIndex="0" Header="true" EnableTabScroll="true" Border="false">
                        <Items>
                            <ext:Panel ID="DummyPanel" runat="server" Title="" Header="false" Border="false" />
                            <ext:Panel runat="server" AutoScroll="true" Layout="FitLayout" ID="QuickViewPanel"          Title="Quick View" />
                            <ext:Panel runat="server" AutoScroll="true" Layout="FitLayout" ID="HoldingsPanel"           Title="Market Value" />
                            <ext:Panel runat="server" AutoScroll="true" Layout="FitLayout" ID="PerformancePanel"        Title="Performance" />
                            <ext:Panel runat="server" AutoScroll="true" Layout="FitLayout" ID="QuickReportsPanel"       Title="Quick Reports" />
                            <ext:Panel runat="server" AutoScroll="true" Layout="FitLayout" ID="PerformanceRefreshPanel" Title="Performance Refresh" />
                            <ext:Panel runat="server" AutoScroll="true" Layout="FitLayout" ID="ReportsPanel"            Title="Reporting" />
                            <ext:Panel runat="server" AutoScroll="true" Layout="FitLayout" ID="TransactionsPanel"       Title="Transactions" />
                            <ext:Panel runat="server" AutoScroll="true" Layout="FitLayout" ID="AccountAdminPanel"       Title="Account Admin" />
                            <ext:Panel runat="server" AutoScroll="true" Layout="FitLayout" ID="ProposalAccountPanel"    Title="UMA Admin" />
                            <ext:Panel runat="server" AutoScroll="true" Layout="FitLayout" ID="HouseholdAdminPanel"     Title="Household Admin" />
                            <ext:Panel runat="server" AutoScroll="true" Layout="FitLayout" ID="PerformanceFiltersPanel" Title="Performance Filters" />
                            <ext:Panel runat="server" AutoScroll="true" Layout="FitLayout" ID="CustomUrlPanel"          Title="Custom URL" />
                        </Items>
                    </ext:TabPanel>
                </Items>
            </ext:Panel>
        </Items>
    </ext:FitLayout>
    Code behind, in the data bind of the page if a condition is met, I call this procedure to change the icon and set the tooltip message
       Public Sub DirtyTab(panelId As String, Optional ByVal DisableIt As Boolean = False)
            For Each p In TabPanel.Items
                If p.ID = panelId Then
                    With CType(p, Ext.Net.Panel)
                        .Icon = Ext.Net.Icon.Error
                        .Disabled = DisableIt
                        .ToolTips.Add(New Ext.Net.ToolTip With {.Html = "This tooltip does not show", .TargetControl = p})
                    End With
                End If
            Next
        End Sub
    I also tried adding a tooltip item in the markup and then refrencing it in code behind to change html and that didn't work either. Hoping I am just missing something simple.

    Thanks,
    Robb
    Last edited by Daniil; May 17, 2013 at 1:32 PM. Reason: [CLOSED]
  2. #2
    Hi Roob,

    Please clarify are you doing it during initial page loading or an AJAX request (DirectEvent/DirectMethod)?
  3. #3
    On the databind of the page so not ajax/direct method
  4. #4
    Please try to remove:
    .TargetControl = p
    It should not be required if a ToolTip is added to a control's ToolTip collection.
  5. #5
    Quote Originally Posted by Daniil View Post
    Please try to remove:
    .TargetControl = p
    It should not be required if a ToolTip is added to a control's ToolTip collection.
    Hey, the problem is that the tab has to be selected in order for the toolTip to show. I need the tooltip to show on the hover over of certain "flagged" tabs even if they are not the currently selected/active tab in the group. Here is a screenshot, the tabs with the Ext.Net.Icon.Error icon I want the user to be able to hover over and see why the error icon is there without having to activate the tab.
    Click image for larger version. 

Name:	Capture.JPG 
Views:	23 
Size:	34.0 KB 
ID:	6242
    Last edited by rmelancon; May 17, 2013 at 12:38 PM.
  6. #6
    Those icons are not separate HTML elements. It is a background-image of a span which holds a tab's title text.

    So, there is no a simple way to target a ToolTip exactly to those icons. But there is a simple way to target a ToolTip to a tab element itself including the icon and title text - just set up a Panel's TabTip property.
  7. #7
    That's what I was looking for, thanks.

Similar Threads

  1. [CLOSED] Adding line series tooltip dynamically.
    By RCM in forum 2.x Legacy Premium Help
    Replies: 3
    Last Post: Apr 04, 2013, 7:06 PM
  2. [CLOSED] Adding a tooltip to calendar Events inside a month-details-panel
    By John_Writers in forum 1.x Legacy Premium Help
    Replies: 3
    Last Post: Mar 18, 2013, 11:56 AM
  3. [CLOSED] Tooltip not being set in the Codebehind...
    By Fahd in forum 2.x Legacy Premium Help
    Replies: 4
    Last Post: Jul 13, 2012, 7:12 PM
  4. Adding Tab using codebehind
    By gevik in forum 1.x Help
    Replies: 9
    Last Post: Oct 02, 2011, 7:43 PM
  5. Replies: 5
    Last Post: Sep 21, 2010, 5:08 PM

Posting Permissions