Click here to Skip to main content
15,892,927 members
Please Sign up or sign in to vote.
0.00/5 (No votes)
See more:
hello
I want that if dropdownlist value is "new group" --> enable txtbox..

**why debugger not work in JavaScript?

What I have tried:

<asp:dropdownlist id="DDlGroups" runat="server" onchange="listBoxSelectedIndexChanged()">


<asp:textbox id="txtNewGroup" runat="server">

JavaScript
<pre>    <script>
        function listBoxSelectedIndexChanged() {
            var ListBox1Id =  '<%= DDlGroups.ClientID %>';
            var TextBox1Id = '<%=txtNewGroup.ClientID %>';
            if (document.getElementById(ListBox1Id).value == "new group") {
                document.getElementById(TextBox1Id).disabled = false;
            }

        }

    </script>
Posted
Updated 14-Jan-20 17:02pm

1 solution

Please, ensure that the AutoEventWireup property value is "true" in the page directive

ex: <%@ Page Language="C#" AutoEventWireup="true" CodeBehind="WebForm20.aspx.cs" Inherits="MyProject.WebForms" %>

Try to pass this as parameter when you call the javascript method in your asp:DropDownList
ex: <asp:dropdownlist id="DDlGroups" runat="server" enabled="true" onchange="listBoxSelectedIndexChanged(this)">
 
Share this answer
 

This content, along with any associated source code and files, is licensed under The Code Project Open License (CPOL)



CodeProject, 20 Bay Street, 11th Floor Toronto, Ontario, Canada M5J 2N8 +1 (416) 849-8900