我有兩個組合框(國家和州)。組合框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" />
某人幫助PLZ – Kings