I need to add an image to news, separate from the content.
To achieve this, I added a field of type "Related media (images, videos, files)" to the News data fields, named it "Image", and set it up as a single selectable image, to use the image selector widget and render as simple link.
In the code, I access the field:
as this worked perfectly on List items. I also tried
I get a RuntimeBinderException ("Cannot perform runtime binding on a null reference"), or a NullReferenceException respectively. Guessed a spelling error and checked multiple times, to no avail. What am I doing wrong?
Edit: Forgot to mention that the view renders with no problems with the concerned code lines removed.