【发布时间】:2013-07-08 12:48:48
【问题描述】:
我正在创建一个页面。
我已使用 EF 为我的表创建类。
表架构如下:
AssetCategory has N TO M relationship with the other two tables
在我的 aspx 页面中,我添加了一个下拉框并使用 EF 从 AssetCAtegaories 填充下拉列表,并从 Field Name 填充所有项目。
我添加了一个网格视图并将其绑定到显示 Jcode 的 AssetCategoryCodes。
现在我需要在这两个项目之间建立联系。
意思是根据用户从下拉列表中的选择在我的网格视图中显示项目。
编辑
MobileAssetCategoryID is Fk in AssetCategoyCodes
MobileAssetCategoryID is FK in DowntimeReasonCodes
for Instance in AssetCategories
if ListItemID =1 and name = Honda
if ListItemID =2 and name = Toyota
than AsstCategoryCodes has
MobileAssetCategory Id=1 , jCode =Accord
MobileAssetCategory Id=1 , jCode =Civic
MobileAssetCategory Id=2 , jCode =Camry
MobileAssetCategory Id=2 , jCode =corolla
所以我的问题是当用户在下拉列表中选择本田时?
我只想展示本田汽车,而不是所有东西。
我该怎么做?
【问题讨论】:
-
AssetCategoryCodes 中的哪个字段链接到 AssetCategories 中的哪个字段?字段名称看起来真的很混乱 - 关系似乎不是很明显......
-
编辑解释表之间的关系
标签: asp.net entity-framework gridview