Hi,
using ASP.NET AJAX controls Q3 2009 I placed several rad comboboxes in a RadDock element. The RadDock should act as a collapsable search panel for a RadGrid on the same page. In the Page_Load event all comboboxes are filled with complete appropriate data. The data of some of them can be confined by the selection of others as in the continents/countries example (related comboboxes). I can't get that example work.
I've implemented the "relation" between a brand and project combo:
1.
<
telerik:RadComboBox
ID
=
"cboBrand"
runat
=
"server"
AccessKey
=
"B"
Width
=
"250px"
Filter
=
"Contains"
2.
ToolTip
=
"bla bla "
OnClientSelectedIndexChanged
=
"loadProjects"
>
3.
</
telerik:RadComboBox
>
4.
<
telerik:RadComboBox
ID
=
"cboProject"
runat
=
"server"
AccessKey
=
"P"
Width
=
"250px"
Filter
=
"Contains"
5.
AllowCustomText
=
"false"
EnableViewState
=
"false"
AutoPostBack
=
"false"
6.
EnableLoadOnDemand
=
"false"
OnItemsRequested
=
"cboProject_ItemsRequested"
OnClientItemsRequested
=
"itemsLoaded"
>
7.
</
telerik:RadComboBox
>
The according javascript functions reside in a special RadCodeBlock (an other block exists for context menu handling for the grid):
01.
<telerik:RadCodeBlock ID=
"SearchComboHandler"
runat=
"server"
>
02.
<script type=
"text/javascript"
>
03.
function
loadProjects(combo, args)
04.
{
05.
var
item = args.get_item();
06.
var
cboProject = $find(
"<%=cboProject.ClientID %>"
);
07.
cboProject.requestItems(item.get_value(),
false
);
09.
}
10.
11.
12.
function
itemsLoaded(combo, eventArqs)
13.
{
14.
if
(combo.get_items().get_count() > 0)
15.
{
16.
combo.set_text(combo.get_items().getItem(0).get_text());
17.
combo.get_items().getItem(0).highlight();
18.
}
19.
}
20.
</script>
21</telerik:RadCodeBlock>
The items of the project combobox are requested as follows (The helper methods returns a data table. It works fine.):
1.
protected
void
cboProject_ItemsRequested(
object
o, RadComboBoxItemsRequestedEventArgs e)
2.
{
3.
cboProject.DataSource = DataHelper.AdminDataRead(
"project"
, Convert.ToInt32(e.Text));
4.
cboProject.DataTextField =
"name"
;
5.
cboProject.DataValueField =
"id"
;
6.
7.
cboProject.DataBind();
8.
}
After selecting an item from the brand combobox the first appropriate project is shown. Further project entries are displayed only after I opened the project combobox two or three times. Debugging clearified that parameters and data/return values are correctly fetched and transmitted.
I've searched the examples, community and other online resources for two days, tried some of the offered solutions but, nothing worked. A hint what I'm doing wrong would be really helpful. If you need more details or code snippets please let me know about.
Thanks in advance,
Andreas