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

Set focus and cursor at the end of text in radcombobox

4 Answers 304 Views
ComboBox
This is a migrated thread and some comments may be shown as answers.
wnl
Top achievements
Rank 1
wnl asked on 01 Jul 2009, 01:45 PM
Hi,
after postback I set focus to RadComboBox. But I would also like the cursor to be positioned at the end of the text field in radcombobox.
How can I position the cusrsor at the end?
Thanks:)

4 Answers, 1 is accepted

Sort by
0
Accepted
Veselin Vasilev
Telerik team
answered on 01 Jul 2009, 03:08 PM
Hi Jaromin Sycz,

Here is how you can achieve that:

protected void c1_SelectedIndexChanged(object o, RadComboBoxSelectedIndexChangedEventArgs e)  
{  
    StringBuilder script = new StringBuilder();  
    script.Append("Sys.Application.add_load(function(){");  
    script.Append("var combo2 = $find('" + RadComboBox2.ClientID + "');");  
    script.Append("combo2.get_inputDomElement().focus();");  
    script.Append("combo2.selectText(combo2.get_text().length, combo2.get_text().length); });");  
      
    RadScriptManager.RegisterStartupScript(Page, Page.GetType(), "comboCursor", script.ToString(), true);  
}  
 

This script will focus the combobox and will place the cursor after the text.

Greetings,
Veselin Vasilev
the Telerik team

Instantly find answers to your questions on the new Telerik Support Portal.
Check out the tips for optimizing your support resource searches.
0
wnl
Top achievements
Rank 1
answered on 02 Jul 2009, 08:22 AM
Yes, indeed. Thanks:)
0
Rakesh
Top achievements
Rank 1
answered on 06 Dec 2010, 10:11 PM
Hello Telerik Team,
    I want to implement the same functionality in Silverlight. For some reason I cant use this radscriptmanager in silverlght. Can you please provide a work-around to place my cursor at the end of the combo-box value?

Thanks
0
Yana
Telerik team
answered on 10 Dec 2010, 09:53 AM
Hi Rakesh,

Please check this forum post.

Best wishes,
Yana
the Telerik team
Browse the vast support resources we have to jumpstart your development with RadControls for ASP.NET AJAX. See how to integrate our AJAX controls seamlessly in SharePoint 2007/2010 visiting our common SharePoint portal.
Tags
ComboBox
Asked by
wnl
Top achievements
Rank 1
Answers by
Veselin Vasilev
Telerik team
wnl
Top achievements
Rank 1
Rakesh
Top achievements
Rank 1
Yana
Telerik team
Share this question
or