+1-888-365-2779
Try Now
More in this section

Forums / Developing with Sitefinity / Trouble binding an IQueryable to a GridView control

Trouble binding an IQueryable<DynamicContent> to a GridView control

3 posts, 0 answered
  1. Keith
    Keith avatar
    67 posts
    Registered:
    13 Sep 2010
    08 May 2013
    Link to this post
    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();
  2. Keith
    Keith avatar
    67 posts
    Registered:
    13 Sep 2010
    09 May 2013 in reply to Keith
    Link to this post
    Anyone....?
  3. Pavel Benov
    Pavel Benov avatar
    341 posts
    Registered:
    14 Mar 2016
    13 May 2013
    Link to this post
    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
3 posts, 0 answered