[update]
Sorry, I should mark this question as MVC-2, I pass the result of the request to view the model, so I have to indicate the type of my model in the View Defintion header. I declare the following:
Inherits="System.Web.Mvc.ViewPage<IQueryable<dynamic>>"
as nothing has ever changed, and none of the answers work for me :(. finally, I used the ModelView class as a helper to include the result of my query in it :(
[/ update]
I have a query like this:
IQueryable<dynamic> result = from d in KiaNetRepository.KiaNetEntities.Discounts where d.AgentTypeID == agentTypeId select new { d.Category, d.DiscountValue, d.PriceConfige };
then I return the value in my view as follows:
foreach(var item in result){ Category cat = item.Category; // throws exception 'object' does not contain a definition for 'Category' //... }
Note that a query type like IQueryable is an anonymouse class ...
source share