More in this section

Forums / Developing with Sitefinity / Using Custom Data Source with ContentView

Using Custom Data Source with ContentView

2 posts, 0 answered
  1. higgsy
    higgsy avatar
    336 posts
    05 Aug 2010
    09 Dec 2010
    Link to this post

    Im using a contentview control to display my data (or trying should I say). The problem is I am using data from two modules, i.e.

    I'm looping through the content items in moduel 1, and then finding content items from module 2 that have a relationship on a specific meta key. It would have been much nicer to be able to do some sort of Linq query, but i couldnt see a way of cross referencing content items. Anyhow, because I need to output 1 list that contains information from both modules using an ILIst is not possible - this is the object that CreateContentList is expecting. I therefore created a DataTable and populated rows appropriately - however, upon binding I get the error message:

    Unable to cast object of type 'System.Data.DataRowView' to type 'Telerik.Cms.Engine.IContent'.

    So it seems the ContentView control is expecting an IList - how can I override this? PResumably I will then have to develop a paging control myself?


  2. Ivan Dimitrov
    Ivan Dimitrov avatar
    16072 posts
    12 Sep 2017
    09 Dec 2010
    Link to this post
    Hi higgsy,

    ContentView expects IList of IContent items. The control is populated through the virtual CreateDataSource() method that you can override. You have to supply an IList, otherwise you have to create a custom control that does not inherit from ContentView or ContentBasic.

    Ivan Dimitrov
    the Telerik team
    Do you want to have your say when we set our development plans? Do you want to know when a feature you care about is added or when a bug fixed? Explore the Telerik Public Issue Tracking system and vote to affect the priority of the items
2 posts, 0 answered