protected void loadgrid() { tokobediaModelContainer db = new tokobediaModelContainer(); var query = from g in db.Products join m in db.ProductTypes on g.ProductTypeID equals m.ID select new { Id = g.ID, Name = g.Name, ProductType = m.Name, Stock = g.Stock, Price = g.Price }; GridAllItem.DataSource = query.ToList(); GridAllItem.DataBind(); }
private void ShowAllItem() { List <Product> product = ViewProductController.GetAllProductController(); var filtered = product.Select(i => new { Id = i.ID, Name = i.Name, ProductType = i.ProductType.Name, Stock = i.Stock, Price = i.Price }); if (filtered.Count() > 0) { GridAllItem.DataSource = filtered; GridAllItem.DataBind(); } }