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

Possible to run webservice when control is focused?

1 Answer 49 Views
ComboBox
This is a migrated thread and some comments may be shown as answers.
Luke Kasper
Top achievements
Rank 1
Luke Kasper asked on 13 Dec 2010, 09:37 PM
All,

Is there a way to set the combobox to re-run the webservice when the box is focused on, on the client side?  My implementation involves a possibility for a user to have text in the box, go to another control on the page, and then use the Tab key to regain focus on the control.  The problem I'm running into is that when the comboBox receives focus, it's not re-running the webservice.

Is this even possible?
Thanks!
-Luke

1 Answer, 1 is accepted

Sort by
0
Kalina
Telerik team
answered on 17 Dec 2010, 03:19 PM
Hello Luke Kasper,

Let me explain to you how Load On Demand works:
When the user types in the input area or clicks on the drop-down toggle image if there are no items in the RadComboBox, the Load On Demand will fire a request for items. That is why if the user has already selected an item from the RadComboBox dropdown and then tabs back to the RadComboBox input - a request for items won't be performed.

However you can try to attach a “keyup” event at RadComboBox input at client-side pageLoad event and fire a request for items within the event handler in this way:

<script type="text/javascript">
 
function pageLoad() {
var combo = $find("<%=RadComboBox1.ClientID %>");
    $telerik.$(combo.get_inputDomElement()).keyup(function(e) {
          
        if(e.keyCode == 9) {
                combo.showDropDown();  
                combo.requestItems("", false);
        }
    });
}
 
</script>


All the best,
Kalina
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
Luke Kasper
Top achievements
Rank 1
Answers by
Kalina
Telerik team
Share this question
or