November Happy Hour will be moved to Thursday December 5th.

Rendering Media

Vote:
 

Hi,

I am trying to render the class ImageFile (inheriting from ImageData). I figured since Media is Content in EPi7.5, I would be able to add images to a ContentArea and this works great. I'm just not able to setup a controller/view for rendering the ImageFile. I setup a new controller inheriting from PartialContentController<ImageFile> but in the ActionResult Index the ImageFile parameter passed is null. Is it not possible to render Media using a controller/view?

public class MediaPartialContentController<T> : PartialContentController<T> where T : MediaData
	{
	}



[TemplateDescriptor(TemplateTypeCategory = TemplateTypeCategories.MvcPartialController, Inherited = true)] public class ImageFileController : PartialContentController<ImageFile> { public override ActionResult Index(ImageFile imageFile) { return PartialView(imageFile); } }

    

 

#79291
Dec 12, 2013 14:33
Vote:
 

The MVC modelBinder only handles "known" parameter names. Try name your parameter to currentContent

#79292
Dec 12, 2013 14:43
Vote:
 

Guess I don´t need to mention I´m new to MVC :)

Thanks a lot Johan, works like a charm!

#79296
Dec 12, 2013 15:05
This topic was created over six months ago and has been resolved. If you have a similar question, please create a new topic and refer to this one.
* You are NOT allowed to include any hyperlinks in the post because your account hasn't associated to your company. User profile should be updated.