set focus to textbox in modal tooltip

2 posts, 0 answers
  1. Kevin Farmer
    Kevin Farmer avatar
    1 posts
    Member since:
    May 2009

    Posted 01 Jul 2010 Link to this post

    I have a modal tooltip and tried the javascript found here in the forum to set focus to a radTextbox and was unable to make it work.

    Here is the HTML markup:



    <form id="form1" runat="server">
    <asp:ScriptManager ID="ScriptManager1" runat="server">
    <telerik:RadScriptBlock ID="rsb" runat="server">
    <script type ="text/javascript">
    function rttPromptShow(sender, eventArgs) {



    function() {
    var txt = $get("<%=txtTest.ClientID %>");
    try {
      if (txt)





    catch (e) { };

    }, 500);



    <asp:Button ID="btnTeset" runat="server" Text="Show Tool Tip" />
    <telerik:RadToolTip ID="rttPrompt" runat="server" Modal="true"
                                   Position="Center" OnClientShow="rttPromptShow"
                                   ShowEvent="FromCode" HideEvent="FromCode" Width="300px" Height="150px">
    <telerik:RadTextBox ID="txtTest" runat="server" Text="Test">




    and here is the code behind:



    Protected Sub btnTeset_Click(ByVal sender As Object, ByVal e As System.EventArgs) Handles btnTeset.Click
       Call rttPrompt.Show()



    End Sub

    I would also like the text in the text box to be selected.

    Any help would be greatly appreciated.









  2. Svetlina Anati
    Svetlina Anati avatar
    2795 posts

    Posted 07 Jul 2010 Link to this post

    Hi Kevin Farmer,

    Basically your code is correct but you shoudl reference teh client object of the RadTextBox by using the method $find and then call the client API method focus which is documented below:

    This being said you should modify your code as shown below:

    function rttPromptShow(sender, eventArgs) { 
    function() {
    var txt = $find("<%=txtTest.ClientID %>");
    try {
      if (txt)

    Best wishes,
    the Telerik team
    Do you want to have your say when we set our development plans? Do you want to know when a feature you care about is added or when a bug fixed? Explore the Telerik Public Issue Tracking system and vote to affect the priority of the items
Back to Top