Trouble binding an IQueryable to a GridView control
I am trying to bind an IQueryable<DynamicContent> to a GridView control, and I am getting this error:
Database mapped field does not exist.
Parameter name: methodCallExpression
Actual value was re-c.FieldValue("DownloadTypes").
Code to bind the control:
gvSearchResults.DataSource = downloads.ToList<DynamicContent>();gvSearchResults.DataBind();Anyone....?
Hello Keith,
Could you please share a bit more of your code and more specifically how are you getting the downloads collection. Also on which line of the code are you getting the error? I have tested the scenario like so:
protected void Page_Load(object sender, EventArgs e) gv.DataSource = RetrieveCollectionOfContents().ToList<DynamicContent>(); gv.DataBind(); public IQueryable<DynamicContent> RetrieveCollectionOfContents() var providerName = String.Empty; DynamicModuleManager dynamicModuleManager = DynamicModuleManager.GetManager(providerName); Type contentType = TypeResolutionService.ResolveType("Telerik.Sitefinity.DynamicTypes.Model.Test.Content"); var myCollection = dynamicModuleManager.GetDataItems(contentType); return myCollection;