How to create a link to details view

Topics: Customizing Orchard, General
Jun 3, 2013 at 10:26 AM
Hi in my summary view I have an image which I would like to make a clickable link to the details view. I am unsure how to do this as each item in my summary view is part of a list. Any ideas please?

Thanks, Kirsty
Jun 3, 2013 at 3:32 PM
Create a view for that content item's type Summary display type, and render the link there using Url.ItemDisplayUrl, e.g.
<a href="@Url.ItemDisplayUrl((IContent)Model.ContentItem)"><img src="..." /></a>
Jun 4, 2013 at 12:13 PM
Hi sfmskywalker

I tried this but I get the following error Compiler Error Message: CS0246: The type or namespace name 'IContent' could not be found (are you missing a using directive or an assembly reference?)

I am using the following template - Fields.MediaPicker-SummaryImage-url-main-property-page.cshtml

Please can you help?

Thank you :)
Jun 4, 2013 at 2:51 PM
Sure. Make sure to import the proper namespace:
@using Orchard.ContentManagement;

<a href="@Url.ItemDisplayUrl((IContent)Model.ContentItem)"><img src="..." /></a>
Jun 18, 2013 at 11:27 AM
Thanks yet again sfmskywalker, I have now got this to work :)