0

I have two ASP.NET dropdownlists on my web page.The second one is disabled by default. Can anyone of you guide me to a javascript code which will enable the second dropdownlist when the selected index in the first one is "4", a clientside trigger ofcourse but i cant seem to figure it out.

I have tried the following:

function ddlstClick() { if (document.getElementById("<%=ddlst_ParameterType.ClientID %>").selectedindex = "4") { ddlst_pulldownParameters.Enabled = true; }

2 Answers 2

1

Try This One.

var e = document.getElementById("<%=ddlst_ParameterType.ClientID %>");
    var strUser = e.options[e.selectedIndex].value;


   if (strUser == "4")
    {
     var x=document.getElementById("<%=seconddropdown.ClientID %>");
        x.disabled=false;
    }
Sign up to request clarification or add additional context in comments.

Comments

0

I think you can do something similar if you like to use JQuery

var value = $("#ddlst_ParameterTypeoption:selected").text();
 if (value == "4")
   $("#ddlst_pulldownParameters").attr('disabled', false);

1 Comment

thanks but i'll try this but as i am completely new to jquery it might take some time...but thanks a lot for your help

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.