I have a query through which I populate grid. Here is the query,
var query = from r in DbContext.Groups
select
new
{
r.Id, r.Name, r.Description, r.UpdatedBy, r.UpdatedDate,
GroupType =DbContext.ProductTypes.Where(p=>p.Id ==
r.ProductTypes_Id).Select(t=>t.Name)
};
So, the problem is that the value of grouptype which is extracted from another table is not displaying the value. It is displaying the type(System.Common….). Can you please help me in fixing this?
Maybe Try
GroupType =DbContext.ProductTypes.Where(p=>p.Id == r.ProductTypes_Id).Select(t=>new { name = t.Name})Or
GroupType =DbContext.ProductTypes.Where(p=>p.Id == r.ProductTypes_Id).FirstOrDefault().Name