Selecting media item by GUID

Tom Troughton asked on December 7, 2015 17:09

I'm working on a portal+ASPX site where I need to take control of image rendering in my code behind. What I want is for a CMS editor to select an item from the media library but internally just store its GUID. I can then render links to this image dynamically, appending resizing parameters to the permanent URL. I don't want my CMS editor to need to specify width and height because to my mind that is a design decision, not a content decision.

I could achieve this to an extent using a Uni Selector control, but then I lose the tree structure of controls like Media Selector. Does anyone know if there is anything built-in which would allow me to save a media item's GUID instead of a URL?

Correct Answer

Jan Hermann answered on December 7, 2015 18:24


I would clone the Media selection form control and change the Value property to store MediaFileGUID instead of the path to media file.

Best regards,
Jan Hermann

1 votesVote for this answer Unmark Correct answer

Recent Answers

Tom Troughton answered on December 8, 2015 10:09

Ah, nice advice, hadn't thought of that, thanks!

0 votesVote for this answer Mark as a Correct answer

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