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

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

1 Answer 336 Views
ListBox
This is a migrated thread and some comments may be shown as answers.
Jita
Top achievements
Rank 1
Jita asked on 22 Jan 2016, 04:33 PM

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?

1 Answer, 1 is accepted

Sort by
0
Eyup
Telerik team
answered on 27 Jan 2016, 12:59 PM
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
Tags
ListBox
Asked by
Jita
Top achievements
Rank 1
Answers by
Eyup
Telerik team
Share this question
or