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

RadComboBox focus problem

4 Answers 200 Views
ComboBox
This is a migrated thread and some comments may be shown as answers.
Dinesh
Top achievements
Rank 1
Dinesh asked on 09 Feb 2011, 09:20 AM
Hi,

I have a  form with RadComboBox. I have set EmptyMessage for RadComboBox. I need to keep that ComboBox focused when the page is loaded and start typing.

I tried followings.

in Page load event

1.
this.Form.DefaultFocus = RadComboBox1.ClientID;

2.
RadAjaxManager am = RadAjaxManager.GetCurrent(this);
 
am.FocusControl(RadComboBox1.ClientID + "_Input");
RadScriptManager1.SetFocus(RadComboBox1);


In 1st method RadComboBox is focused but EmptyMessge is not cleared. when we type, "EmptyMessage" also remains.

In 2nd method all work fine only in IE. but not in FireFox or Chrome.

Can anybody help regarding this matter ?.

Thank you,

Dinesh 

4 Answers, 1 is accepted

Sort by
0
Shinu
Top achievements
Rank 2
answered on 09 Feb 2011, 10:21 AM
Hello Dinesh,

You could achieve the desired behavior from client side.For that you need to
  • Get the client-side instance of the combobox
  • Get the DOM element of the input field
  • Focus the input field 
Please check this help article which which explains more on this.

Thanks,
Shinu.
0
Dinesh
Top achievements
Rank 1
answered on 09 Feb 2011, 10:49 AM
Hi Shinu,

Thank you for the reply. I saw the url you send. In my case focusing works. "EmptyMesage" remain even the RadComboBox is focused and cursor is blinking in front of the "empty message" we need to delete EmptyMessage each time.

I resolve this with javascript. On document load. I set the value of INPUT (gen from RadComboBox) to blank. 

window.onload = function () {
    var cid = "<%=CmbItems.ClientID %>" + "_Input";
    var input = document.getElementById(cid);
 
    input.value = "";
}


Is there any better solution for this ?

Thank you,

Dinesh
0
Charles Embling
Top achievements
Rank 1
answered on 17 Jun 2011, 04:11 AM
Dinesh,

Did you ever get this resolved?

I applied the same work around however I have a problem in IE.

On page load, I set focus to the radComboBox (that is within a user control) from a content page.  Everything works fine but when i start typing in IE, the first character I type is cleared out along with the Empty Message (BAD). 

In Chrome, the first character I type is NOT cleared (GOOD).

I love Chrome and hate IE, but my customers all use IE still. 

Thanks,
Chuck.
0
Helen
Telerik team
answered on 23 Jun 2011, 08:07 AM
Hello Charles,

Could you please open a support ticket and send us a sample project which demonstrates the issue to examine it locally?

Greetings,
Helen
the Telerik team

Browse the vast support resources we have to jump start 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
Dinesh
Top achievements
Rank 1
Answers by
Shinu
Top achievements
Rank 2
Dinesh
Top achievements
Rank 1
Charles Embling
Top achievements
Rank 1
Helen
Telerik team
Share this question
or