How to set Focus on a "RadTextBox" after listbox.get_selectedItem().set_selected(false)

2 posts, 0 answers
  1. Jita
    Jita avatar
    8 posts
    Member since:
    Sep 2014

    Posted 22 Jan Link to this post

    I have a pannel control, where I want a specific textbox to be selected after the listbox.get_selectedItem(). but in the javascript side if I put #RadTextboxID.focus() it never comes down there and the RadTB is not selected.

    MY code in the JS side

    function AddNewTask() {
        $('.emptyTaskList').hide();  
        var listbox = $find('rlbTasks');
        $('#lblEditTaskSign').html('Add Task/Milestone');
        $('#lbDeleteTask').hide();
        listbox.get_selectedItem().set_selected(false);
      $( "#rtbName" ).focus();

     

    And the page does not post back so setting it in the page_load did not help. 

     

    I also tried :

     <telerik:RadTextBox ClientEvents-OnLoad="onClientLoad" runat="server" ID="rtbName" MaxLength="255" />                                                    

    function onClientLoad(sender) // executes when loading the RadTextBox 
    {
        sender.focus();
    }

     

    Did not work? how should I approach this issue?

  2. Eyup
    Admin
    Eyup avatar
    3014 posts

    Posted 27 Jan Link to this post

    Hi Jita,

    Try the following approach:
    function buttonClick() {
        var textBox = $find('<%= rtbName.ClientID %>');
        textBox.focus();
    }

    Regards,
    Eyup
    Telerik
    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 Feedback Portal and vote to affect the priority of the items
  3. UI for ASP.NET Ajax is Ready for VS 2017
Back to Top