In my site I have created a media type for audio files with underlying downloads (PDF files for lecture notes). I am able to list the files on a page and make them downloadable. However, I would like to create a page for each audio file on which more information is displayed for the file, and a neat list of all the associated lecture note files is displayed.
Is there a way to create a page in Umbraco (or a custom page) to which I pass the media item (in this case the audio file-media item) as a parameter, which looks up the actual media item and lists all the associated lecture note PDFs?
What if you just append a query string to your URL? (like .../?media=1035)
Then you can create a controller for your DocumentType and check the Request property if it contains the media query.
What you can also do is implement the IContentFinder which can redirect to a specific controller for specific URLs.
How to pass a media item to an Umbraco page?
In my site I have created a media type for audio files with underlying downloads (PDF files for lecture notes). I am able to list the files on a page and make them downloadable. However, I would like to create a page for each audio file on which more information is displayed for the file, and a neat list of all the associated lecture note files is displayed.
Is there a way to create a page in Umbraco (or a custom page) to which I pass the media item (in this case the audio file-media item) as a parameter, which looks up the actual media item and lists all the associated lecture note PDFs?
Some help would be greatly appreciated!
What if you just append a query string to your URL? (like
.../?media=1035
) Then you can create a controller for yourDocumentType
and check theRequest
property if it contains themedia
query.What you can also do is implement the
IContentFinder
which can redirect to a specific controller for specific URLs.Bye Tobi
Thanks :), that works fine.
I now use a link to a page, containing a query string parameter like this: <a href="/audio-file?mediaId=@mediaItem.Id">go</a>.
Then I get the right media item in my template (or in a helper class to separate code from html):
is working on a reply...