【问题标题】:Cascading Combo Box does not function properly级联组合框无法正常工作
【发布时间】:2012-05-16 17:03:42
【问题描述】:

我有两个组合框(国家和州)。组合框 2(州)应使用组合框 1(国家)中选择的值加载关联的州。

问题是,第一次选择国家组合框项目时,会在第二个组合框中加载正确的关联国家。但是当在组合框 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" />

【问题讨论】:

    标签: asp.net combobox


    【解决方案1】:

    您是否尝试过设置 EnableLoadOnDemand="false"?

    【讨论】:

    • 是的。这并没有什么不同。
    • @Kingz 设置 AllowCustomText="false" 怎么样?
    猜你喜欢
    • 1970-01-01
    • 2015-10-23
    • 1970-01-01
    • 2012-05-29
    • 1970-01-01
    • 1970-01-01
    • 2020-04-23
    • 2019-09-14
    • 1970-01-01
    相关资源
    最近更新 更多