1

I have a databound DropDownList and I need a code that will only show the DropDownList if there is a value in the Database, if the there is no value/empty DropDownlist it should not be visible.

I tried:

   if (ddlFruits.Items.Count == 1)
     {
         ddlFruits.Visible = false;
     }
     else
     {
         ddlFruits.Visible = true;

     }
Jana Pasch
  • 9
  • 1
  • 9

1 Answers1

0
ddlFruits.Visible = ddlFruits.Items.Count > 0
mybirthname
  • 17,949
  • 3
  • 31
  • 55