0

i need to bind the @html.dropdownlist() using another dropdownlist .

For example: ddl1: Letters and numbers.

  1. when i select the letters in ddl1 bind the letters like a,b,c,d in ddl2
  2. when i select the numbers in ddl1 bind the numbers like 1,2,3,4 in ddl2

in default page loading

dd1: select the case and dd2: select the dd1

using mvc3 format

1 Answer 1

1

I think you need jquery to do that.

$("#Dropdown1").change(function () {
            var value= $("#Dropdown").val();
            if(value=="Letters")
        {
        populatedropdown(listofletters);
        }
       else if(value=="Numbers")
        {
        populatedropdown(listofnumbers);
        }
        });


 function populatecities(list) {
        $("#dropdown2").html('');
        $.each(list, function (id, option) {
            select.append($('<option></option>').val(id).html(option));
        });
    }

I think this will do it...

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

Comments

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.