This project is read-only.

how to acquire url from title part?

Topics: General
Mar 20, 2012 at 2:49 AM

Hey guys, I have a summary view from a projection which contains an image. Ultimately, I want to add the title url to the image [clickable link] as well, for most people click the image instead of the title expecting it to go to the detail view. What is the best way to obtain the detail's url?

I dont want to combine hardcoded, as in:

"/Item/Display" + @Model.ContentPart.ContentItem.Id etc.

but I cant find a better solution when rummaging through shape trace. Has anyone done this before, or can point me in the right direction, cheers pg

Mar 20, 2012 at 6:13 AM

Sorry guys, obviously the following is the way to go:

<a href="@Url.ItemDisplayUrl(contentItem)">
I missed it because I had it in my head it was @Html.ItemDisplayUrl...oh well, live and learn, cheers anyway, pg