asp.net - radio button check and uncheck other radio buttons the web form is connected with a database created using ms access -


i have 2 radio buttons in web application named male , female , used following code check button , uncheck other 1 isnt working when m ruunning both selected .what do?

    protected void radiobutton1_checkedchanged(object sender, eventargs e)     {         if (radiobutton1.checked == true)         {             radiobutton2.checked = false;         }         else         {             radiobutton2.checked = true;           }       }      protected void radiobutton2_checkedchanged(object sender, eventargs e)     {         if (radiobutton2.checked == true)         {             radiobutton1.checked = false;         }         else         {             radiobutton2.checked = true;         } 

you should using radiobuttonlist this. give radio buttons belong same group , automatically have behavior other buttons in group unchecked when different button in group checked.


Comments

Popular posts from this blog

google chrome - Developer tools - How to inspect the elements which are added momentarily (by JQuery)? -

angularjs - Showing an empty as first option in select tag -

php - Cloud9 cloud IDE and CakePHP -