populated using webservice +LoadOnDemand

2 posts, 1 answers
  1. Łukasz Kuryło
    Łukasz Kuryło avatar
    24 posts
    Member since:
    Jan 2010

    Posted 23 Mar 2010 Link to this post

    Hi all.
    I have a combobox populated using webservice with LoadOnDemand. My question is how can I select one specific element in combobox when it is populated?
    And my second question. The combobox is populated only when I click on the drop down array icon. I would like to populate it when the page is load (or the control is load).How can I do that?
  2. Answer
    Kalina avatar
    918 posts

    Posted 26 Mar 2010 Link to this post

    Hi Łukasz Kuryło,

    When Load On Demand feature is enabled, the RadComboBox populates with data after user types in the input area or clicks on the drop-down toggle image.
    I am not sure that I understand your requirement, but in case like this you will be not able to predict what values will be populated in order to set a default selected value.

    There is an option to set the selected index client side at OnClientItemsRequested event:
    function OnClientItemsRequestedHandler(sender, eventArgs)
        var combo = $find("<%=RadComboBox1.ClientID %>");
        if (sender.get_items().get_count() > 2) {

    <telerik:RadComboBox ID="RadComboBox1" runat="server" Height="100px" Width="220px"
        ShowMoreResultsBox="true" EnableLoadOnDemand="True" 
        OnClientItemsRequested="OnClientItemsRequestedHandler" >
        <WebServiceSettings Path="LoadItemsWebService.asmx" Method="GetCompanyNames" />

    To fire the web service method and load the items when the page loads you can use the requestItems method of the combobox:

    Sys.Application.add_load(function() {
       var combo = $find("<%= RadComboBox1.ClientID %>");
       //invoke the webMethod, e.Text would be empty string
       combo.requestItems("", false);

    More details you can find at sample page attached.
    Please let me know if this was helpful.

    Kind regards,
    the Telerik team

    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 Public Issue Tracking system and vote to affect the priority of the items.
Back to Top