2012-05-08 51 views
1

我有两个组合框(国家和州)。组合框2(国家)应使用组合框1(国家)中选定的值加载相关国家。Cascading Combo Box无法正常工作

问题是,首次选择某个国家/地区组合框项目时,会在第二个组合框中加载正确的关联状态。但是当在组合框1中选择另一个值时,组合框内的值仍显示旧值。

注意: -第二次NewValues在组合框2中正确加载。但单击组合框箭头时只显示这些不显示(只有旧值可见)。但是,如果我们在第二个组合框中输入任何内容,则会显示新值。

问题: - 我想要加载新的值在第二个组合框中加载,它应显示在组合框箭头的单击上。不只是在输入内容后。

类: -

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" /> 
+0

某人帮助PLZ – Kings

回答

0

你试过设置EnableLoadOnDemand = “假”?

+0

是的。这没有什么区别。 – Kings

+0

@Kingz如何设置AllowCustomText =“false”? –