我有一个显示建筑物信息的 GridView。我正在将信息从这样的数据库加载到 GridView 中:
var buildings = (from t in dc.Towns
where (t.userid == userid) && (t.time < DateTime.Now)
join b in dc.Buildings
on t.buildingid equals b.buildingid
into j1
from j2 in j1.DefaultIfEmpty()
group j2 by j2.buildingname
into grouped
select new
{
Building= grouped.Key,
Picture= grouped.First().imagePath,
Number= grouped.Count()
});
gvBuildings.DataSource = buildings.ToList();
gvBuildings.DataBind();
但我无法显示图像,它只显示其保存的路径。如何在 GridView 中显示路径中的图像?