0

I am developing an ASP .Net MVC 3 application using C# and SQL Server 2005.

In a view, I have a DropDownList and a button.

Using javascript, when I click in the button,,,the dropdownlist became disabled.

But when I click second time in this button, the dropdownlist still disabled.

Is there any solution to make it enabled in the second click.

This is the code :

<%: Html.DropDownListFor(model => model.SelectedProfile_Ga, new SelectList(Model.Profile_GaItems, "ID_Gamme", "ID_Gamme"), new { @id = "gg" })%> 
 <input type="button" value="Configurer" id="btnShowGestion" onclick="GamDis()"/>
script type="text/javascript">

     function GamDis() {

         var gg = document.getElementById('gg');
         var bb = document.getElementById('btnShowGestion');


         gg.disabled = 'disabled';

     }

    </script> 
1
  • @JohnH not the same but thanks , i found the solution Commented May 22, 2013 at 15:43

1 Answer 1

2

To re-enable the element, you need to remove the "disabled" attribute completely.

     if (gg.disabled) {
         gg.removeAttribute("disabled");
     } else {
        gg.disabled = 'disabled';
     }
Sign up to request clarification or add additional context in comments.

Comments

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.