我对 ASP.NET MVC 还是很陌生(或者至少在更高级的场景中使用它时)——所以我正在寻找针对特定使用场景的一些反馈以及实现它的最佳方法。我尝试进行了多次搜索 - 但没有找到类似的东西。
我对实现它的方法很灵活——只要提议的解决方案运行良好。
比如说,我有一个名为 的实体Vehicle
,它与一个实体相关联,VehicleType
并且Vehicle
还与一个属性实体相关联,具体基于被VehicleType
调用的VehicleProperties
。例如 - 车辆类型可以是“Car”、“Boat”等,VehicleProperties 包含 Car VehicleType 的“BodyStyle”、“Color”等以及“Boat”VehicleType 的“Length”、“Weight”等
On the create and edit forms for the VehicleConntroller
I'm looking to do something along these lines: Have a drop down list of vehicle types and when the selection of that changes load the appropriate "VehicleProperties" form that is specific to this VehicleType.
这就是我的问题所在 - MVC 中最好的方法是什么?寻找 AJAX 类型的方法。如果有人有任何示例教程或文章可以概述潜在的解决方案 - 我将不胜感激!
我目前正在使用带有 jQuery 的 ASP.NET MVC 5 - 但如果需要一个优雅的解决方案,我愿意添加其他 JS 库。