How to Disable the button while selecting the items in combobox in C# asp.net -


how disable button if there aren't selected in combobox? here code have tried

if (satellitecombobox.items.count > 0) {     displayproductiondatabutton.enabled = false; } 

i have tried not working, appreciate of suggestion

first of , should set true autopostback property dropdownlist. after , in selectedindexchange event can use desired code :

if (dropdownlist1.selectedindex < 0)         {             button1.enabled = false;         }         else         {             button1.enabled = true;         } 

in code when user doesn't select item , button disabled. or can set first item of dropdownlist value 'choose ...' , change code this,it's better users :

if (dropdownlist1.selectedindex <= 0)             {                 button1.enabled = false;             }             else             {                 button1.enabled = true;             } 

Comments

Popular posts from this blog

sql - VB.NET Operand type clash: date is incompatible with int error -

SVG stroke-linecap doesn't work for circles in Firefox? -

python - TypeError: Scalar value for argument 'color' is not numeric in openCV -