Jquery 为什么我的级联下拉列表不起作用?(ASP.NET[MVC 3])

Jquery 为什么我的级联下拉列表不起作用?(ASP.NET[MVC 3]),jquery,ajax,asp.net-mvc,json,asp.net-mvc-3,Jquery,Ajax,Asp.net Mvc,Json,Asp.net Mvc 3,我的级联dropdownlist DDL有问题,当您选择第一个DDL时,它可以很好地工作,当您选择第二个DDL时,第三个DLL不会启动,并且值为空 这是我的JS 看法 模型 控制器 这是因为你瞄准了错误的元素: $('#Floor_SelectedFloorID').change(function () { 当您应该这样做时: $('#Floor_SelectedItem').change(function () { $.getJSON'@Url.ActionFloor'。。。。 我认为Ur

我的级联dropdownlist DDL有问题,当您选择第一个DDL时,它可以很好地工作,当您选择第二个DDL时,第三个DLL不会启动,并且值为空

这是我的JS

看法

模型

控制器


这是因为你瞄准了错误的元素:

$('#Floor_SelectedFloorID').change(function () {
当您应该这样做时:

$('#Floor_SelectedItem').change(function () {

$.getJSON'@Url.ActionFloor'。。。。
我认为Url.Action也不会像这样工作…

approved@von v。它现在开始工作了。感谢@Lakshay的回复,但是V.Von的建议解决了我的难题。-1$.getJSON'@Url.actionfloor'一直都有效
Imports System
Imports System.Collections.Generic
Imports System.ComponentModel
Imports System.ComponentModel.DataAnnotations
Imports System.Globalization
Public Class ItemClass
    Private _code As String
    Private _description As String
    Private _ClassItems As System.Collections.Generic.List(Of ItemClass)
    Private _Type As MDL.Type
    Private _Types As System.Collections.Generic.List(Of MDL.Type)
    Private _SelectedClassItem As String
    Private _SelectedTypeItem As String
    Private _SelectedSubTypeItem As String



    Public Property SelectedClassID As String
        Get
            Return _SelectedClassItem
        End Get
        Set(value As String)
            _SelectedClassItem = value
        End Set
    End Property

    Public Property SelectedTypeID As String
        Get
            Return _SelectedTypeItem
        End Get
        Set(value As String)
            _SelectedTypeItem = value
        End Set
    End Property

    Public Property SelectedSubTypeID As String
        Get
            Return _SelectedSubTypeItem
        End Get
        Set(value As String)
            _SelectedSubTypeItem = value
        End Set
    End Property

    <DataType(DataType.Text)> _
    <Display(Name:="Type")> _
    Public Property code() As String
        Get
            Return _code
        End Get
        Set(ByVal Value As String)
            _code = Value
        End Set
    End Property
    <DataType(DataType.Text)> _
    <Display(Name:="Type")> _
    Public Property description() As String
        Get
            Return _description
        End Get
        Set(ByVal Value As String)
            _description = Value
        End Set
    End Property

    Public Property ClassItems() As System.Collections.Generic.List(Of ItemClass)
        Get
            Return _ClassItems
        End Get
        Set(ByVal value As System.Collections.Generic.List(Of MDL.ItemClass))
            _ClassItems = value
        End Set
    End Property
    ''' <summary>
    ''' Property for collection of Type
    ''' </summary>
    ''' <pdGenerated>Default opposite class collection property</pdGenerated>
    Public Property Type() As MDL.Type
        Get
            Return _Type
        End Get
        Set(ByVal value As MDL.Type)
            _Type = value
        End Set
    End Property
    Public Property Types() As System.Collections.Generic.List(Of Type)
        Get
            Return _Types
        End Get
        Set(ByVal value As System.Collections.Generic.List(Of Type))
            _Types = value
        End Set
    End Property
    Public Overrides Function ToString() As String
        Return Me._description
    End Function


End Class
  public JsonResult GetCascadeBuildings()
    {
        return Json(FA_CS.Helpers.BuildingList.Status, JsonRequestBehavior.AllowGet);
    }

    public JsonResult GetCascadeFloors(string buildingCode)
    {
        var gathererS = new List<MDL.Floor>();
        gathererS = GetFloors(buildingCode);
        return Json(gathererS, JsonRequestBehavior.AllowGet);
    }

    public List<MDL.Floor> GetFloors(string BuildingCode)
    {
        FAWebService.Service1 faws = new FAWebService.Service1();
        Array arr = faws.GatherFloor(BuildingCode);
        MDL.Floor oFloor = new MDL.Floor();
        List<MDL.Floor> oFloors = new List<MDL.Floor>();
        foreach (FAWebService.Floor itm in arr)
        {
            oFloors.Add(new MDL.Floor { SelectedItem = itm.Code, Description = itm.Description });
        }
        return oFloors;

    }


    public JsonResult GetCascadeLocations(string buildingCode, string floorCode)
    {
        var gatherer = new MDL.Location();
        var gathererS = new List<MDL.Location>();
        gathererS = GetLocations(buildingCode, floorCode);
        return Json(gathererS, JsonRequestBehavior.AllowGet);
    }

    public List<MDL.Location> GetLocations(string BuildingCode, string floorCode)
    {
        FAWebService.Service1 faws = new FAWebService.Service1();
        Array arr = faws.GatherLocation(BuildingCode, floorCode);
        MDL.Location oLocation = new MDL.Location();
        List<MDL.Location> oLocations = new List<MDL.Location>();
        foreach (FAWebService.Location itm in arr)
        {
            oLocations.Add(new MDL.Location { Code = itm.Code, Description = itm.Description });
        }
        return oLocations;

    }
$('#Floor_SelectedFloorID').change(function () {
$('#Floor_SelectedItem').change(function () {