我的mvc app中有以下视图模型。
Public Class SiteCatModel
Public Property SiteCatValue As String
Public Property SiteCatDescription As String
Private Function GetSiteCategories() As List(Of SiteCatModel)
Dim sitCategoryList = New List(Of SiteCatModel)() From {
New SiteCatModel() With {.SiteCatValue = "A",
.SiteCatDescription = "A - 24 x 7"},
New SiteCatModel() With {.SiteCatValue = "B",
.SiteCatDescription = "B - xxxxxx"
},
New SiteCatModel() With {.SiteCatValue = "C",
.SiteCatDescription = "C - xxxxx"
},
New SiteCatModel() With {.SiteCatValue = "D",
.SiteCatDescription = "D - xxxxx"
},
New SiteCatModel() With {.SiteCatValue = "E",
.SiteCatDescription = "E - xxxxx"
},
New SiteCatModel() With {.SiteCatValue = "Z",
.SiteCatDescription = "Z - ?????"
}
}
Return sitCategoryList
End Function
Public Function GetSiteCategoryData() As JsonResult
Dim siteCategories = GetSiteCategories()
Return JSon(siteCategories, JsonRequestBehavior.AllowGet)
End Function
End Class
在最后一个函数中,Return Json 在Visual Studio 2015中突出显示错误,该错误表示未声明JSon。由于其保护级别,它可能无法访问。
我已经尝试搜索可能的修复程序,但我的所有结果都是关于IE中的错误...这个错误在VS中,我无法构建应用程序,所以我甚至没有从浏览器中获取错误。< / p>