none
AnonymousType RRS feed

  • Question

  • Hi folks, receiving anonymous type error, not really sure how to resolve this problem! I'm trying to populate a Gridview with suppliers details code below;

      public void LoadSuppliers()
            {
                TyrescannerWebApp.IdentityModel.tyrescannerdatabaseEntities dbcontext = new TyrescannerWebApp.IdentityModel.tyrescannerdatabaseEntities();
    
                var query = from suppliers in dbcontext.Suppliers_View
                          
                           where suppliers.GarageID == 1
                select new
                            {
                                suppliers.GarageID,
                                suppliers.SupplierID,
                                suppliers.SupplierName,
                                suppliers.SupplierContactName,
                                suppliers.SupplierTelephone
                            };
    
                GridView1.DataSource = query.ToList();
                GridView1.DataBind();
            }

    Monday, December 28, 2015 5:36 PM

Answers

  • Projecting Anonymous Types

    http://www.csharp-station.com/Tutorial/Linq/Lesson02

    • Marked as answer by brucey54 Tuesday, December 29, 2015 6:43 AM
    Monday, December 28, 2015 7:57 PM