Trouble binding an IQueryable<DynamicContent> to a Gri

Posted by Community Admin on 04-Aug-2018 15:00

Trouble binding an IQueryable to a GridView control

All Replies

Posted by Community Admin on 08-May-2013 00:00

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();

Posted by Community Admin on 09-May-2013 00:00

Anyone....?

Posted by Community Admin on 13-May-2013 00:00

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;
        

But I was not able to reproduce the problem. I have also tried with simple ToList() which worked too.

Kind regards,
Pavel Benov
the Telerik team
Do you want to have your say in the Sitefinity development roadmap? Do you want to know when a feature you requested is added or when a bug fixed? Explore the Telerik Public Issue Tracking system and vote to affect the priority of the items

This thread is closed