Media Gallery Querystring

Katrina Miday asked on July 29, 2014 13:31

I was looking to use the Media Gallery webparts (gallery/filter/folder tree) but with querystring paths different than the defaults, for example "folder" for "path" and "toyid" rather than "fileid."

I've updated the appropriate fields in the webpart settings for each that I have on the page, but am having issues with the gallery webpart and the default transformation.

The default transformation is using HTMLHelper.HTMLEncode(MediaLibraryFunctions.GetMediaFileDetailUrl(Eval("FileID"))) to create the URL to the image's detail page (ex: url?path=name&fileid=123).

I know I could simply modify the transformation to use something like "url?toyid=" + Eval("FileID"), but I was wondering about the mechanisms to the MediaLibraryFunctions.GetMediaFileDetailUrl? Is it possible for it to use toyid rather than fileid in creating the URL to the details?

Also, how are the File ID's assigned? We'll be directly linking to these in the future so I need to make sure the URL to specific images won't change. I know I could use the permanent link directly to the image, but we'd really like to link to a page with the image details on it as well.

Thanks in advance!

Recent Answers

Martin Florian answered on March 9, 2015 10:37

The GetMediaFileDetailUrl transformation method can have two parameters (as you can see in our API reference). First is query string and second is FileID. You can therefore use it as follows (test is my FileID specified in Media gallery web part configuration)

<a href="<%# HTMLHelper.HTMLEncode(MediaLibraryFunctions.GetMediaFileDetailUrl("test",Eval("FileID"))) %>" title="<%# ResHelper.GetString(Convert.ToString(Eval("FileDescription"))) %>">

0 votesVote for this answer Mark as a Correct answer

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