I have 2 viewmodels each of them have a property called RSSFeed of type RSS. I have 2 views (one for each viewmodel) and I want them to share the same partialview which renders the data in RSSFeed.
In my main views, I have:
@{ Html.RenderPartial("Social", new ViewDataDictionary(Model)); }
In my Social partiavlview I wanted to use something like:
@ViewBag.RSSFeeds.Feed[0].Title
Running that give me 'Cannot perform runtime binding on a null reference'
Each ViewModel has:
public RSS RSSFeed = new RSS();
The supporting classes are:
public class RSSItem
{
public string Title { get; set; }
public string Link { get; set; }
public string Description { get; set; }
public DateTime PubDate { get; set; }
}
public class RSS
{
public string FeedURL { get; set; }
public List<RSSItem> Feed = new List<RSSItem>();
}
Any help is greatly appreciated. I wonder if I am actually able to do what I am looking to do or have completely done this the wrong way.