Click here to Skip to main content
14,872,121 members
Please Sign up or sign in to vote.
0.00/5 (No votes)
See more:
Here is my view
SQL
@Html.LabelFor(Function(m) m.City)
                      @Html.DropDownListFor(Function(m) m.City, New SelectList(Model.citylst, "CityId", "CityName"), "--Select--")



SQL
@Html.LabelFor(Function(m) m.Country)
                    @Html.DropDownListFor(Function(m) m.Country, New SelectList(Model.statelist, "stateid", "CountryName"), "--Select--")


Controller:-
For city when state is selected :-
VB
If i IsNot Nothing Then
          Dim vs1 = From fr In dbpra.CityMasters _
                    Where fr.StateID = str _
                    Select fr.CityName, fr.CityId

          For Each fr1 In vs1
              citylst.Add(New CityMaster With {.CityId = fr1.CityId, .CityName = fr1.CityName})
          Next
      End If



For state:-

SQL
Dim vs = From sta In dbpra.StateMasters
                Select New With {sta.StateId, sta.StateName}
       For Each fr In vs
           statelist.Add(New StateMaster With {.StateId= fr.StateId, .StateName= fr.StateName})
       Next





And use this jquary

SQL
$(document).ready(function () {
           $("#StateId").change(function () {
               var url = "/User/Users";

               var first = $(this).val();
               $.post(url, { Value: first }, function (data) {

                   //                    alert(data.CityId);
                   //                    alert(data.CityName);
                   alert(data);

               });
           });
       });

its work but there is no change on view
Posted
Updated 18-Apr-12 11:52am
v2
Comments
Nelek 18-Apr-12 17:52pm
   
Edit: Missing code tags

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