RadComboBox changing selected item when clicking o

2019-09-17 17:21发布

问题:

If I select any item of a RadComboBox, next when I click on other parts of the page then the RadComboBox item is changing. How do I solve this problem?

aspx:

<telerik:RadComboBox ID="cmbExpCTC" runat="server" MarkFirstMatch="true">
</telerik:RadComboBox>

C#:

public void FillStatus()
{
    try
    {
        cmbExpCTC.Enabled = true;

        dsLocation = BizRegion.GetCandidateInterviewStatus(hfdcandidateid.Value, hfdjobid.Value, hfdRounds.Value);
        RadComboBoxItem cItem = new RadComboBoxItem("Sourcing in process", "Sourcing");
        cmbExpCTC.Items.Add(cItem);
        if (dsLocation.Tables[0].Rows.Count > 0)
        {
            for (int i = 0; i <= dsLocation.Tables[0].Rows.Count - 1; i++)
            {
                cItem = new RadComboBoxItem(dsLocation.Tables[0].Rows[i]["InterviewFormat"].ToString() + " - " + "Round" + " " + dsLocation.Tables[0].Rows[i]["Rounds"].ToString(), "Sourcing");
                cmbExpCTC.Items.Add(cItem);
            }
        }
    }
    catch { }
}

回答1:

I got solution, i added OnClientDropDownClosed javascript function to RadComboBox.

<telerik:RadComboBox ID="cmbExpCTC" runat="server" MarkFirstMatch="true" EnableLoadOnDemand="true"  OnClientDropDownClosed="OncmbExpCTCDropDownClosed" >
                    </telerik:RadComboBox>

  function OncmbExpCTCDropDownClosed(sender, args) {
            sender.clearItems();
            if (args.get_domEvent().stopPropagation)
                args.get_domEvent().stopPropagation();
        }