Ajax tooltip with asp:button

2 posts, 0 answers
  1. Michael Tissington
    Michael Tissington avatar
    64 posts
    Member since:
    Nov 2007

    Posted 19 Nov 2007 Link to this post

    I have an asp:button with an OnCommand event.

    In the code behind I'd like to Validate the page and return either the tooltip (and show it) or do some other processing.

    How do I go about returning the tooltip and showing it ?

  2. Tsvetie
    Admin
    Tsvetie avatar
    1517 posts

    Posted 20 Nov 2007 Link to this post

    Hello Michael Tissington,
    Please have a look at the following code fragment that demonstrates one possible approach:

    aspx:
    <body> 
        <script type="text/javascript">  
        function OpenToolTip()  
        {  
            Sys.Application.add_load(ShowToolTip);          
        }  
          
        function ShowToolTip()  
        {  
            var tooltip = $find('<%= RadToolTip1.ClientID %>');  
            tooltip.show();  
            Sys.Application.remove_load(ShowToolTip);  
        }  
        </script> 
        <form id="form1" runat="server">  
            <asp:ScriptManager ID="ScriptManager1" runat="server" /> 
            <telerik:RadToolTip ID="RadToolTip1" runat="server" TargetControlID="Button1"   
                RelativeTo="Element" ShowEvent="OnRightClick">  
            </telerik:RadToolTip> 
            <asp:Button ID="Button1" runat="server" Text="ShowToolTip" OnClick="Button1_Click" /> 
        </form>      
    </body> 

    code-behind:
    protected void Button1_Click(object sender, EventArgs e)  
    {  
        if (Button1.Text == "ShowToolTip")  
        {  
            Page.RegisterStartupScript("openToolTip""<script>OpenToolTip();</script>");  
            Button1.Text = "Second";  
        }  


    All the best,
    Tsvetie
    the Telerik team

    Instantly find answers to your questions at the new Telerik Support Center
Back to Top