Search code examples
asp.netdrop-down-menuddlvisible

want asp dropdownlist selection to make panel visible


I have an asp dropdownlist that I would like to make a panel visible if the selection contains a certain word- how would this be possible?


Solution

  • lets say you have dictionary like this

    List<string> words = new List<string>();
    words.Add("foo");
    

    then onchange event of drop down list

    string selectedText = ddlPanel.SelectedText;
    foreach(var w in words)
    {
     if ( w.Contains(selectedText)
      {
         pnl.Visible = true;
      }
    }