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

[Solved] Populating cascading combobox using WebMethod

2 Answers 261 Views
ComboBox
This is a migrated thread and some comments may be shown as answers.
Shailesh Shahane
Top achievements
Rank 1
Shailesh Shahane asked on 16 Jun 2009, 12:50 PM
Hi,
How can we populate cascading combobox using WebMethod.
e.g. I have 2 comboboxes in grid. where on page load 1st combobox will call WebMethod and it should return items respective to that row primary id. i.e. i need to pass id to WebMethod.
Again on selection of item in 1st combobox other combobox should call another WebMethod which should accept selected items value of first combobox and populate second one.

As per example I've seen that WebMethod accepts RadComboBoxContext parameter. How can we send extra parameter to WebMethod?

thanks,

2 Answers, 1 is accepted

Sort by
0
Accepted
Atanas Korchev
Telerik team
answered on 17 Jun 2009, 03:05 PM
Hi Shailesh Shahane,

You can check this help article which explains how to pass parameters to the RadComboBoxContext object.

Kind regards,
Albert
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
Shailesh Shahane
Top achievements
Rank 1
answered on 24 Jun 2009, 01:09 PM
HI,
Thanks. given link was helpful.
but here i'm facing other problem.
I want to trigger demand download of one combobox on selectedindex change 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

Tags
ComboBox
Asked by
Shailesh Shahane
Top achievements
Rank 1
Answers by
Atanas Korchev
Telerik team
Shailesh Shahane
Top achievements
Rank 1
Share this question
or