Portal Engine Questions on portal engine and web parts.
Version 7.x > Portal Engine > Unable to set MediaLibraryName on MediaGallery web part View modes: 
User avatar
Certified Developer v7
Certified  Developer v7
lucyht - 11/21/2013 11:56:27 AM
   
Unable to set MediaLibraryName on MediaGallery web part
Hi there,

Kentic version: v7.0.58

I have an aspx page with the ~/CMSWebParts/MediaLibrary/MediaGallery.ascx user control loaded. If I set the MediaLibraryName via the declarative code it works as expected. However as soon as I try to set it in the code behind then no content is displayed.

Here is the declarative code:
<%@ Register Src="~/CMSWebParts/MediaLibrary/MediaGallery.ascx" TagName="MediaFileGallery" TagPrefix="cmsBI" %>

<cmsBI:MediaFileGallery ID="FileBrowserMediaGallery" runat="server"
ShowSubfoldersContent="false"
DisplayFileCount="true"
DisplayActiveContent="false"
HideFolderTree="false"
UseSecureLinks="false"
AllowUpload="true"
AllowUploadPreview="false"
TransformationName="BI.Transformations.MediaLibrary"
FilterMethod="0"
SortQueryStringKey="sort"
FileIDQueryStringKey="fileid"
PathQueryStringKey="path"
PageSize="5"
QueryStringKey="page"
GroupSize="10"
DisplayFirstLastAutomatically="true"
DisplayPreviousNextAutomatically="true"
HidePagerForSinglePage="false"
OutputResolveURLs="true"
OutputFixAttributes="true"
OutputFixJavascript="true"
OutputFixLowerCase="true"
OutputFixTags="true"
OutputFixHTML5="true" />

and the code in Page_Load (tried several other page events as well) is:
EnsureChildControls();
FileBrowserMediaGallery.MediaLibraryName = KeyValue;
FileBrowserMediaGallery.SetValue("MediaLibraryName", KeyValue);
FileBrowserMediaGallery.ReloadData();

Any ideas what I am missing?

Lucy

User avatar
Member
Member
kentico_sandroj - 12/1/2013 2:22:54 PM
   
RE:Unable to set MediaLibraryName on MediaGallery web part
Hello,

I am able to reproduce this issue and on first look it seems to be a bug. I will confirm and check with the developers then provide an update.

Regards,
Sandro

User avatar
Certified Developer v7
Certified  Developer v7
lucyht - 12/2/2013 11:55:36 AM
   
RE:Unable to set MediaLibraryName on MediaGallery web part
Hi Sandro,

I am working around this at the moment by loading the MediaFileGallery usercontrol dynamically. I then can set the LibraryName and any other properties without problem, would be nice to have it on my page declaratively as opposed to a placeholder if possible.

Regards,
Lucy

User avatar
Member
Member
kentico_sandroj - 12/5/2013 8:26:48 PM
   
RE:Unable to set MediaLibraryName on MediaGallery web part
Hi Lucy,

Sorry about the delay. Please try to set the media name as follows and let me know if this works as expected:

        protected override void OnInit(EventArgs e)
{
base.OnInit(e);

FileBrowserMediaGallery.MediaLibraryName = "test";
FileBrowserMediaGallery.ReloadData();
}


Thanks,
Sandro