I've two combo-box(Countries and States). Combo-box 2 (States) should load associated States with the value selected in the Combo-box 1(Countries).
Problem:- first time selection of a Countries combo-box item, loads the correct associated States in the 2nd combo-box. But when an another value is selected in combo-box 1. The Values inside combo-box still displays old values.
NOTE:- On 2nd time NewValues are loaded properly in combo-box 2. But those are not displayed when the the combo-box arrow is click (Only old values are visible). But if we type anything in that 2nd combo-box, New values are displayed.
QUESTION:- I want evertime the new values are loaded up in 2nd combo-box, it should be displayed on the click of combo-box arrow. Not just after typing something.
CLASS:-
protected
void
Countries_SelectedIndexChanged(Object sender, Telerik.Web.UI.RadComboBoxSelectedIndexChangedEventArgs e)
{
int
countryIDselected = Convert.ToInt32(Countries.SelectedValue);
bool
AdvanceSearchFlag =
true
;
Session[
"AdvanceSearchFlag"
] = AdvanceSearchFlag;
Session[
"countryIDselected"
] = countryIDselected.ToString();
int
totalStates = States.Items.Count;
int
xyz = totalStates - 1;
if
(totalStates != 0)
{
while
(totalStates > 0)
{
States.Items.Remove(totalStates - 1);
totalStates --;
}
}
States.Items.Clear();
}
protected
void
States_ItemsRequested(
object
sender, Telerik.Web.UI.RadComboBoxItemsRequestedEventArgs e)
{
foreach
(StateyLookupInfo state
in
StateLookupList.GetList(
false
))
{
RadComboBoxItem item =
new
RadComboBoxItem(State.StateName, State.StateID.ToString());
comboBox.Items.Add(item);
}
}
ASPX:-
<
telerik:RadComboBox
ID
=
"Countries"
runat
=
"server"
AutoPostBack
=
"True"
OnSelectedIndexChanged
=
"Countries_SelectedIndexChanged"
/>
<
telerik:RadComboBox
ID
=
"States"
runat
=
"server"
AutoPostBack
=
"True"
EnableLoadOnDemand
=
"true"
OnItemsRequested
=
"States_ItemsRequested"
/>