0

I have a asp.dropdown list set enabled=false, is it posible to modify through javascrip to enabled=true? This should happen after a Textbox has a value in it.

4
  • Yes, with the disabled property: w3schools.com/jsref/prop_select_disabled.asp Commented Apr 13, 2016 at 20:13
  • If you need more help please provide the html Commented Apr 13, 2016 at 20:35
  • This is the ASP tag <asp:DropDownList ID="PrsPlzDdl" runat="server" Enabled="false" AutoPostBack="true" OnSelectedIndexChanged="PrsPlzDdl_SelectedIndexChanged" Width="100%" Height="66%"> and I was trying to modify it by Javascrip with: document.getElementById("PrsPlzDdl").disable = true; Using a keyup event on a differente asp control. Textbox to be exact Commented Apr 15, 2016 at 15:16
  • I'm a first timer in Stackoverflow I apologize for not formmatting the last comment. ☺' Commented Apr 15, 2016 at 15:26

1 Answer 1

1

Do you mean Enabled="False"? If so, no you cannot - you must do this from the code behind. You are getting the server attributes and client attributes confused. Enabled is not the same as disabled for the client side. You cannot change the server variable Enabled on a runat="server" tag.

Sign up to request clarification or add additional context in comments.

3 Comments

Good answer. I thought about the effect on the button, and did not consider the Enabled property itself, as I should have done.
Thanks now I understand why my code was not working. I did not know there were two sets of attributes, I thought they were just called different. Any way gotta re-write code, different approach needed.
No problem I also found (and still find) Web Forms confusing at times. I welcome the day where I can work exclusively in MVC & MVVM architectures :)

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.