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

[Solved] Populate combobox on SelectedIndexChange client event of other combobox

1 Answer 143 Views
Ajax
This is a migrated thread and some comments may be shown as answers.
Shailesh Shahane
Top achievements
Rank 1
Shailesh Shahane asked on 25 Jun 2009, 11:39 AM
i'm trying to trigger on demand download of one combobox on selectedindex change (Client side Javascript ) event of other combobox.
e.g.
on selected index change event of country i want to populate states in other combobox using WebMethod
here what i tried,
//Country combobox event
function onSelectedIndexChanged(sender, eventArgs) {
        var id = eventArgs._item.get_value();
       var ddlstate = $get('ddlStateComboBoxID');
        ddlstate.control._doLoadOnDemandFromWebService(id, { NumberOfItems: 0, Text: '', ID: id });
    }
It calls WebMethod and get result properly at client side.
But it is giving javascript error on callback. It seems it is not initializing other methods that required before calling _doLoadOnDemandFromWebService.
so using which method i can start populating State Combo box?

Also I'm using Grid. and inside that i have 2 comboboxes on each row. So i can not use <%= State.ClientID %> in javascript.
So I'm creating JSon object having Country combo Id as Name and State combo id as its value(Not shown in above example).
Is there any other better way to define relation.

thanks & regards,
Shailesh

1 Answer, 1 is accepted

Sort by
0
Accepted
Yana
Telerik team
answered on 29 Jun 2009, 02:43 PM
Hi Shailesh,

I suggest you use requestItems client-side method of RadComboBox in order to initiate request to the web service.

Regards,
Yana
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.
Tags
Ajax
Asked by
Shailesh Shahane
Top achievements
Rank 1
Answers by
Yana
Telerik team
Share this question
or