N Number of Media Library Items in a Page Type?

Fahlgren Mortine asked on November 8, 2016 19:40

Good afternoon. In a previous iteration of a client site, a custom Page Type included the ability to attach PDF documents to the page in question. This worked well, but most pages included PDF documents that were also used on other similar pages and sometimes on completely different pages in other sections of the site. This made PDF document management very difficult. To solve this, I'm moving all PDF documents to the Media Library. Now my issue is how to assign said PDF documents to individual pages of a given Page Type. I can use a URL Selector field to add a single PDF, but the problem is that there could be a number of PDF documents per page - and I don't know the upper limit of this number. Is there a way in a custom Page Type to load an unknown number of Media Library items into the page? My fallback is to simply use a WYSIWYG field, but I'd very much like to avoid this. Thanks!

Kentico 9.0 ASPX + Portal

Recent Answers


Zachary Perry answered on November 8, 2016 20:17

I am not sure of another way than the WYSIWYG approach if you add the files to a media library. You could create a custom form control to handle this.

Not sure how viable this would be, but an alternative to storing all the files in a media library is to store them as CMS.FIle in the tree, then use related pages to link them to the pages they are needed for.

0 votesVote for this answer Mark as a Correct answer

Brenden Kehren answered on November 8, 2016 23:07

One way I've done in the past for something similar is to model the media library files in a similar fashion as the content tree. Place your files in the correct directory and have a repeater and a datasource get those files based on the path you're currently in.

Another way is to create your own form control which will allow you to link or create multiple files to a page.

Yet another way is to assign add the PDFs as attachments to the document. This does not require you to move them all to the media library but it will require you to attach them all to the page.

Yet another way is to create a linking in say a custom table or a module which allows you to select a page and a media file GUID or URL. Then just repeat through those custom table items to get all the media files for the given URL you're on.

0 votesVote for this answer Mark as a Correct answer

   Please, sign in to be able to submit a new answer.