How to Search Through a C# DropDownList Programmatically

后端 未结 9 1173
一生所求
一生所求 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 06:01

    foreach (ListItem li in dropdownlist1.Items)
    {
        if (li.Value == textBox1.text)
        {
           // The value of the option matches the TextBox. Process stuff here.
        }
    }
    

    That is my suggestion for how to see if the value is in the dropdownlist.

提交回复
热议问题