Click here to Skip to main content
14,422,431 members
Rate this:
Please Sign up or sign in to vote.
See more:
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">

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


Updated 5 days ago

1 solution

Rate this:
Please Sign up or sign in to vote.

Solution 1

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)">

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

CodeProject, 503-250 Ferrand Drive Toronto Ontario, M3C 3G8 Canada +1 416-849-8900 x 100