How to Search Through a C# DropDownList Programmatically

后端 未结 9 1112
一生所求
一生所求 2021-02-14 05:24

I am having a hard time figuring out how to code a series of \"if\" statements that search through different dropdownlists for a specific value entered in a textbox. I was able

9条回答
  •  有刺的猬
    2021-02-14 05:46

    I would make a list of Drop-down boxes and then use linq to select on it.

    List list = new List();
    list.Item.Add(dropdown1);
    list.Item.Add(dropdown2); 
    .... (etc)
    
    var selected = from item in list.Cast()
                   where item.value == textBox1.text
                   select item;
    

提交回复
热议问题