【问题标题】:Bind GridView With Foreign Key Value用外键值绑定 GridView
【发布时间】:2013-09-16 08:14:57
【问题描述】:

城市

CityID
Name
CountryID(FK)

国家

CountryID
CountryName

我想在 gridview 中显示所有城市显示 CountryName 而不是 CountryID With EntityDatasource

什么是最好的解决方案?

【问题讨论】:

    标签: asp.net entity-framework-5


    【解决方案1】:

    你能在内部加入国家表和城市表吗? 选择 t1.Name, t1.CountryId , t2.CountryId, t2.CountryName Cities t1 inner join countries t2 on t1.CountryID=t2.CountryID

    你可以用 Cuntryname 代替 CountryID

    【讨论】:

      猜你喜欢
      • 1970-01-01
      • 2020-08-12
      • 1970-01-01
      • 1970-01-01
      • 1970-01-01
      • 1970-01-01
      • 2019-07-31
      • 1970-01-01
      • 2012-01-15
      相关资源
      最近更新 更多