How to Search Through a C# DropDownList Programmatically

后端 未结 9 1172
一生所求
一生所求 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条回答
  •  梦毁少年i
    2021-02-14 05:40

    while(dropdownlist1.SelectedIndex++ < dropdownlist1.Items.Count)
    {
        if (dropdownlist1.SelectedValue == textBox1.text)
        {
          // Add your logic here.
        }
    }
    
    //resetting to 0th index(optional)
    dropdownlist1.SelectedIndex = 0;
    

提交回复
热议问题