I am trying to create a list of images that have been attached to my custom module.
But getting an error.
Object reference not set to an instance of an object. (attached)
I am using the following code to do it:
model.SelectedEvent = dynamicModuleManager.GetDataItems(wDREventType).Where(i => i.Id == eventId).Where(s => s.Status == Telerik.Sitefinity.GenericContent.Model.ContentLifecycleStatus.Live).FirstOrDefault();
LibrariesManager libraryManager = LibrariesManager.GetManager();
var imageLinks = (ContentLink)model.SelectedEvent.GetValue("Images");
foreach (var imageLink in imageLinks)
var image = libraryManager.GetImage(imageLink.ChildItemId);
//add new item to list
return View("Default", model);
I got this code from Gabe's seminar. So i thought it would work.
But it does not.
Any idea of what is going on here?