【问题标题】:How to remove Multiple Items from RadComboBox如何从 RadComboBox 中删除多个项目
【发布时间】:2015-11-04 03:31:54
【问题描述】:

我有一个如下所示的 RadComboBox

 <radC:RadComboBox ID="lstMaterial" runat="server" Width="100px"  Height="100px" DropDownWidth="100px" />

在 aspx.cs 页面中根据条件需要从上面的 RadComboBox 控件中添加和删除多个项目,如下所示。

if(isTrue)
{
    //Remove
            List<string> strRemoveList = new List<string>();
                    strRemoveList.Add(lstMaterial.FindItemByText("Wood1").ToString());
                    strRemoveList.Add(lstMaterial.FindItemByText("Seam").ToString());
                    strRemoveList.Add(lstMaterial.FindItemByText("wood2").ToString());

                   // lstMaterial.Items.Remove(strConstructionStyleRemoveList);
           //foreach(RadComboBoxItem rcbi in lstConstructionStyle.Items)
                   // {
                   //     rcbi.Remove(strRemoveList);
                    // }

}

【问题讨论】:

    标签: c# radcombobox


    【解决方案1】:

    我相信您遇到的错误是由于从 foreach 循环的源中删除项目。尝试循环 strRemoveList,然后在该循​​环中从 rcbi 中删除。

    例子:

    foreach(string itemToRemove in strRemoveList)
    {
        rcbi.Remove(itemToRemove);
    }
    

    【讨论】:

      猜你喜欢
      • 2013-08-31
      • 1970-01-01
      • 1970-01-01
      • 1970-01-01
      • 2015-04-13
      • 2014-05-17
      • 1970-01-01
      • 1970-01-01
      • 2021-10-19
      相关资源
      最近更新 更多