This is a migrated thread and some comments may be shown as answers.

When pressing Enter within ToolTip, an ImageButton outside of ToolTip gets executed

1 Answer 71 Views
ToolTip
This is a migrated thread and some comments may be shown as answers.
Jason Zam
Top achievements
Rank 1
Jason Zam asked on 03 Feb 2010, 03:09 PM
Hello,

I am having an issue with the ToolTip control.

I have several image buttons on a web page doing different functionality.  One of these image buttons, when clicked, displays a ToolTip which then contains a textbox and regular asp.net button.  

With the ToolTip displayed, if the user clicks (doesn't hit enter) the asp.net button within the ToolTip, it functions as expected and the code behind the asp.net ToolTip button gets executed.  However, when the user hits "enter" (instead of clicking the asp.net button) while the ToolTip textbox has focus, the code from a completely different image button NOT within the ToolTip gets executed.

The problem seems to be that when the ToolTip has focus and the user hits the "enter" button, the wrong code gets executed.  If anything, I would expect the button on the ToolTip to be executed when a user hits the "enter" button.

NOTE:  I have not set any default buttons within my web page by using "Page.Form.DefaultButton".

Any help would be greatly appreciated.

Thanks,
Jason

1 Answer, 1 is accepted

Sort by
0
Svetlina Anati
Telerik team
answered on 08 Feb 2010, 03:57 PM
Hello Jason Zam,

I tested the described scenario and I was able to reproduce the problem. However, when I replaced the RadToolTip with a standard update panel, it also did not keep the focus - please examine the following code:

main page:

        <asp:Button ID="MainPageBtn" runat="server" OnClick="OnClick" Text="MianPageBtn" />
  
        <script type="text/C#" runat="server"
      
              
            protected void Page_Load(object sender, EventArgs e)
            {
                if (scriptManager.IsInAsyncPostBack)
                {
                    up1.ContentTemplateContainer.Controls.Add(Page.LoadControl("WebUserControl.ascx"));
                }
            }
  
            protected void OnClick(object sender, EventArgs e)
            {
                Response.Write("MainPageBtn handler called! Time: " + DateTime.Now.ToString());
            }
        </script>
  
        <script type="text/javascript"
  
function showToolTip(element) 
   __doPostBack("<%=up1.UniqueID %>", "TEST");
}
  
        </script>
  
        <asp:UpdatePanel ID="up1" runat="server">
            <ContentTemplate>
            </ContentTemplate>
        </asp:UpdatePanel>
        <div runat="server" id="dblclk1" style="display: inline" ondblclick="showToolTip(this)">
            RadToolTipManager used</div>
    </form>


user control:

<%@ Control Language="C#" AutoEventWireup="true"  %>
<script type="text/C#" runat=server>
  
  protected void OnClick(object sender, EventArgs e)
    {
        Label1.Text = "ToolTipBtn server handler executed! Time: " + DateTime.Now.ToString();
    }
  
</script>
<asp:Label ID="Label1" runat="server" Text="Initial"></asp:Label>
<asp:Button ID="btn" runat="server" OnClick="OnClick" Text="ToolTipBtn"/>

As you see, the update panel also does not keep the focus in this scenario.

What I can suggest is to simply reset the focus when needed by using javascript. Let me know whether this works for you.


Greetings,
Svetlina
the Telerik team

Watch a video on how to optimize your support resource searches and check out more tips on the blogs.
Follow the status of features or bugs in PITS and vote for them to affect their priority.
Tags
ToolTip
Asked by
Jason Zam
Top achievements
Rank 1
Answers by
Svetlina Anati
Telerik team
Share this question
or