[CLOSED] Tooltip doesn't get updated with OnDirectClick Event...

  1. #1

    [CLOSED] Tooltip doesn't get updated with OnDirectClick Event...

    Hi,
    I want to update the tooltip with a DirectEvent, but it doesn't seems to work for me.

    It does work on Page Load, but I need it to work on a Direct Event.

    <%@ Page Language="C#" %>
    
    <%@ Register Assembly="Ext.Net" TagPrefix="ext" Namespace="Ext.Net" %>
    
    <script runat="server">              
        protected void Page_Load(object sender, EventArgs e)
        {
            //NOTE: WORKS HERE !!!
            //Button1.ToolTips.Add(new ToolTip()
            //{
            //    Title = @"Comments Added:",
            //    Html = "Value will be added here...",
            //    AnchorHorizontal = "50%"
            //});
        }
    
    
        protected void UpdateTooltip(object sender, DirectEventArgs e)
        {
            //NOTE: DOESN'T WORK HERE !!!
            Button1.ToolTips.Add(new ToolTip()
            {
                Title = @"Comments Added:",
                Html = "Value will be added here...",
                AnchorHorizontal = "50%"
            });
        }
          
    </script>
    
    <!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
    <html xmlns="http://www.w3.org/1999/xhtml">
    <head id="Head1" runat="server">
        <title>Ext.NET Example</title>
    </head>
    <body>
        <form id="Form1" runat="server">
        <ext:ResourceManager ID="ResourceManager1" runat="server" />
        <ext:Button ID="Button1" Text="Update" Icon="Accept" runat="server" OnDirectClick="UpdateTooltip" />
        </form>
    </body>
    </html>
    Last edited by Daniil; Jun 12, 2012 at 2:11 PM. Reason: [CLOSED]
  2. #2
    Hi,

    Populating the Tooltips collection after rendering doesn't affect.

    You could re-render the Button calling its Render button.

    Example
    <%@ Page Language="C#" %>
     
    <%@ Register Assembly="Ext.Net" TagPrefix="ext" Namespace="Ext.Net" %>
     
    <script runat="server">              
        protected void UpdateTooltip(object sender, DirectEventArgs e)
        {
            this.Button1.ToolTips.Add(new ToolTip()
            {
                Title = "Title",
                Html = DateTime.Now.Second.ToString()
            });
            this.Button1.Render();
        }
           
    </script>
     
    <!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" 
        "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
    
    <html xmlns="http://www.w3.org/1999/xhtml">
    <head runat="server">
        <title>Ext.NET Example</title>
    </head>
    <body>
        <ext:ResourceManager runat="server" />
        <ext:Button 
            ID="Button1" 
            Text="Update" 
            Icon="Accept" 
            runat="server" 
            OnDirectClick="UpdateTooltip" />
    </body>
    </html>
    If you'd like to avoid re-rendering the Button, you could render just a Tooltip. I would prefer that approach.

    Example
    <%@ Page Language="C#" %>
     
    <%@ Register Assembly="Ext.Net" TagPrefix="ext" Namespace="Ext.Net" %>
     
    <script runat="server">              
        protected void UpdateTooltip(object sender, DirectEventArgs e)
        {
            ToolTip t = new ToolTip()
            {
                ID = "Tooltip1",
                Target = this.Button1.ClientID,
                Title = "Title",
                Html = DateTime.Now.Second.ToString()
            };
            this.Controls.Add(t);
            t.Render();
        }
           
    </script>
     
    <!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" 
        "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
    
    <html xmlns="http://www.w3.org/1999/xhtml">
    <head runat="server">
        <title>Ext.NET Example</title>
    </head>
    <body>
        <ext:ResourceManager runat="server" />
        <ext:Button 
            ID="Button1" 
            Text="Update" 
            Icon="Accept" 
            runat="server" 
            OnDirectClick="UpdateTooltip" />
    </body>
    </html>
  3. #3
    Button has Tooltip and QTipCfg properties.
    Tooltip property is updated automatically if you change a value.
    To update QTipCfg during DirectEvent you can use SetTooltip method
  4. #4
    Thanks guys, that works for me...

    Quote Originally Posted by Vladimir View Post
    Button has Tooltip and QTipCfg properties.
    Tooltip property is updated automatically if you change a value.
    To update QTipCfg during DirectEvent you can use SetTooltip method

Similar Threads

  1. Replies: 2
    Last Post: Jan 16, 2012, 10:34 AM
  2. OnDirectClick
    By cbu in forum 1.x Help
    Replies: 1
    Last Post: Jan 05, 2012, 7:48 PM
  3. [CLOSED] MultiCombo Tooltip BeforeShow Event
    By softmachine2011 in forum 1.x Legacy Premium Help
    Replies: 4
    Last Post: Nov 22, 2011, 12:07 PM
  4. [CLOSED] GridPanel Row Tooltip ShowDelay doesn't work.
    By drkoh in forum 1.x Legacy Premium Help
    Replies: 2
    Last Post: May 06, 2010, 4:05 PM
  5. Replies: 2
    Last Post: May 05, 2010, 10:23 AM

Tags for this Thread

Posting Permissions