ASPX templates
Version 5.x > ASPX templates > Add media gallery web parts to apsx template created with VS2010 View modes: 
User avatar
Member
Member
Mark - 8/13/2010 8:44:08 AM
   
Add media gallery web parts to apsx template created with VS2010
I am trying to create 4 pages: photo uploader, photo gallery, video uploader and video gallery. I am using aspx C# templates created in VS 2010 so I can use the root master to provide consistent look and feel.

What I have not been able to figure out is: how do I add the media gallery web parts to the code? I tried to add the Kentico CMS features to the toolbox in VS 2010 (as detailed somewhere on this site), but so far, I have been unable to use the tools. Drag and drop does not appear to work.

I can create an ad-hoc template in Kentico and replicate most of the look and feel but I want to know how to accomplish this via VS 2010 using the aspx templates I created there.

Thank you,
Mark

User avatar
Member
Member
Mark - 8/24/2010 1:16:46 PM
   
RE:Add media gallery web parts to apsx template created with VS2010
Nothing yet?

User avatar
Kentico Support
Kentico Support
kentico_radekm - 10/5/2010 9:47:51 AM
   
RE:Add media gallery web parts to apsx template created with VS2010
Hello.

I believe our dll which you can add to VS´ toolbox contains CMS controls only.
What you need is web part. Web parts for media gallery can be found in your <project folder>/CMSWebParts/MediaLibrary section. Media gallery web part itself is in CMSWebParts/MediaLibrary/MediaGallery.ascx.

If you want to use this web part on your page, you need to register it in a standard .NET way like this:

<%@ Register Src="~/ CMSWebParts/MediaLibrary/MediaGallery.ascx " TagName="MediaGallery" TagPrefix="cms" %>


Then, you can use it like:

<cms:MediaGallery ID="gallery" runat="server" (…) />


(…) means additional properties you need to set. You can see them using IntelliSense. You can check required web part properties e.g. on our default Corporate site, which is included in your installation as web site template and can be installed via New site wizard in Site Manager -> Sites.

For example, you need to set TransformationName, SelectedItemTransformation, MediaLibraryPath, and so on. List of these properties and their value you can see in example above (on Portal engine Corporate site it is /Examples/Webparts/Media library/Media gallery page).

Best Regards,
Radek Macalik

User avatar
Member
Member
Mark - 10/8/2010 1:51:49 PM
   
RE:Add media gallery web parts to apsx template created with VS2010
Thank you! That was the information I was looking for. Does the documentation cover any of this in more detail? I've been through most of it.

User avatar
Kentico Developer
Kentico Developer
kentico_ivanat - 10/11/2010 8:30:40 AM
   
RE:Add media gallery web parts to apsx template created with VS2010
Hi,

If you are creating aspx template you can use following documentation:
http://devnet.kentico.com/docs/devguide/creating_a_new_aspx_page_template.htm?zoom_highlightsub=aspx

All you need to do is:
1. Register the webpart
2. Use it as a control

The only difference between the webpart and the control are properties of the webpart. The name in the IntelliSense is sometimes different from the name in the Portal Engine.

For example: Show for document types vs. ClassNames.

If you are not sure what properties should be set, you can find inspiration on the default Corporate site (Portal Engine version).

The list of available webparts is here:
http://devnet.kentico.com/docs/webparts/KenticoCMS_WebParts.htm

Best regards,
Ivana Tomanickova

User avatar
Member
Member
Mark - 10/22/2010 3:24:59 PM
   
RE:Add media gallery web parts to apsx template created with VS2010
This is what I have so far:

<div class="zoneCenter" style="float: left;">

<div align="center">Photo Gallery</div>

<cms:MediaGallery
MediaLibraryName="Photo"
MediaLibraryPath="~/Media/Photos/"
runat="server"
PagerSize="6"
PagerLayout="CMS.PagerTransformations.General-PagerLayout" HeaderTransformation="Community.Transformations.MediaLibraryHeader" FooterTransformation="Community.Transformations.MediaLibraryFooter" SeparatorTransformation="Community.Transformations.MediaLibraryItemSeparator" SelectedItemTransformation="Community.Transformations.MediaLibrarySelectedItem" TransformationName="Community.Transformations.MediaLibrary" />
</div>

Any suggestions? I still can't see the images.

Thanks,
Mark

User avatar
Kentico Support
Kentico Support
kentico_radekm - 10/26/2010 8:04:18 AM
   
RE:Add media gallery web parts to apsx template created with VS2010
Hello.

Could you please call this code in Page_Load event in your aspx page?

this.cntMediaGallery.ReloadData();

Where cntMediaGallery is ID of your control (web part).

Best Regards,
Radek Macalik

User avatar
Member
Member
Mark - 10/26/2010 8:17:00 AM
   
RE:Add media gallery web parts to apsx template created with VS2010
I don't understand what you mean.

ID of the control (web part)?

Mark

User avatar
Member
Member
Mark - 10/26/2010 10:00:02 AM
   
RE:Add media gallery web parts to apsx template created with VS2010
OK I figured it out.

I did not have an ID property (as indicated in my example I posted) so I created one. Still does not display images. I think there is still a property missing or a bad path somewhere.

Mark

User avatar
Member
Member
Mark - 10/26/2010 10:01:38 AM
   
RE:Add media gallery web parts to apsx template created with VS2010
One other note: the code I posted is contained in the photogallery page. It is not a separate web part.

Mark

User avatar
Kentico Support
Kentico Support
kentico_radekm - 11/1/2010 3:03:06 AM
   
RE:Add media gallery web parts to apsx template created with VS2010
Hello.

I wrote a knowledge-base article about how to add and configure Media Gallery web part on ASPX page template. This article includes all required properties and whole code, also with screenshot of a result. Since it is not online yet, could you please send e-mail to support@kentico.com and refer to this forum post? I will send you this article by e-mail. Thank you.

Best Regards,
Radek Macalik

User avatar
Member
Member
Mark - 11/1/2010 8:57:36 AM
   
RE:Add media gallery web parts to apsx template created with VS2010
Thanks for the information Radek. It works perfectly! The problem with the database retaining the reference to the image has also disappeared (re my other post in the Bugs section).

Thank you!
Mark

User avatar
Member
Member
Mark - 11/10/2010 11:45:26 AM
   
RE:Add media gallery web parts to apsx template created with VS2010
One follow up: when I attempted to implement this as a new page for another site, the images did not display correctly. They 'stepped'. (First row had three images, second row indented one space and had two images, third row indented two spaces and had one image...). This happened in the by 'Name' or by 'Size' views, but not in the by 'Date' view.

Very curious.

I created a new template and did exactly the same thing as with the first site image gallery. Possible problem with the application?

Mark

User avatar
Kentico Support
Kentico Support
kentico_radekm - 11/17/2010 2:49:11 AM
   
RE:Add media gallery web parts to apsx template created with VS2010
Hello.

So far, I am not able to reproduce this issue. It can be related e.g. to cache, but I would need to have list of steps I can follow to reproduce this problem. If you are able to reproduce it, could you please create new topic (to not mix more issues in a single thread) and describe, how to reproduce it? We will examine it then. Thank you.

Best Regards,
Radek Macalik

User avatar
Member
Member
Mark - 11/17/2010 9:01:17 AM
   
RE:Add media gallery web parts to apsx template created with VS2010
Hi Radek,

I investigated further and discovered the problem exists when these modes are selected:

Name ASC
Date ASC
Size DESC

The opposite selections display the images just fine (Name DESC, Date DESC, Size ASC). I noticed the behavior when I clicked the Sort By for each successively.

I'm going to look at the transformations in CMS desk to see if the previous person customized or broke something that could be causing this behavior. As I stated before, I have only observed this in 1 of our 4 sites.

Mark

User avatar
Kentico Support
Kentico Support
kentico_radekm - 12/6/2010 7:08:58 AM
   
RE:Add media gallery web parts to apsx template created with VS2010
Hello Mark.

I have been testing it on my ASPX site (v5.5.3978), but so far I am not able to reproduce the issue. I tried all following scenarios:

default.aspx?sort=FileName;ASC&fileid=<id>
default.aspx?sort=FileName;DESC&fileid=<id>

default.aspx?sort=FileCreatedWhen;ASC&fileid=<id>
default.aspx?sort=FileCreatedWhen;DESC&fileid=<id>

default.aspx?sort=FileSize;ASC&fileid=<id>
default.aspx?sort=FileSize;DESC&fileid=<id>

And I can see all images properly. It may be related to something I am not able to cover on my instance, so if you would like to investigate it deeply, I would need your project folder and DB backup, so I can reproduce it on the very same environment.

Best Regards,
Radek Macalik

User avatar
Member
Member
gstaylor-sfopera - 1/25/2011 3:15:52 PM
   
RE:Add media gallery web parts to apsx template created with VS2010
Is there any way to page the folder tree list? I've got a long list of media library folders and I'd like to divide the list in to pages with navigation ability.

I didn't see any properties for a pager.

User avatar
Member
Member
gstaylor-sfopera - 1/25/2011 4:43:16 PM
   
RE:Add media gallery web parts to apsx template created with VS2010
And I cannot seem to get the MediaGallery web part to display any images. It displays the folder tree but no images no matter which folder I click on. Here's what I've put in to my template;

<uc1:MediaGallery ID="cntMediaGallery" runat="server" CurrentPageTemplate="CMS.PagerTransformations.General-CurrentPage"
DisplayActiveContent="true" DisplayFileCount="true"
DisplayFirstLastAutomatically="true" DisplayPreviousNextAutomatically="true"
FileIDQueryStringKey="fileid" FilterMethod="0"
FirstPageTemplate="CMS.PagerTransformations.General-FirstPage"
FooterTransformation="Community.Transformations.MediaLibraryFooter"
HeaderTransformation="Community.Transformations.MediaLibraryHeader"
HideFolderTree="false" HidePagerForSinglePage="true"
LastPageTemplate="CMS.PagerTransformations.General-LastPage"
MediaLibraryName="Press_Room" MediaLibraryPath="Faust"
NextGroupTemplate="CMS.PagerTransformations.General-NextGroup"
NextPageTemplate="CMS.PagerTransformations.General-NextPage" PageSize="9"
PathQueryStringKey="path"
PreviousGroupTemplate="CMS.PagerTransformations.General-PreviousGroup"
PreviousPageTemplate="CMS.PagerTransformations.General-PreviousPage"
SelectedItemTransformation="Community.Transformations.MediaLibrarySelectedItem"
SeparatorTemplate="CMS.PagerTransformations.General-PageSeparator" SeparatorTransformation="Community.Transformations.MediaLibraryItemSeparator"
ShowSubfoldersContent="true" SortQueryStringKey="sort"
TransformationName="Community.Transformations.MediaLibrary"
UseSecureLinks="true" AllowUpload="False" AllowUploadPreview="False" CacheMinutes="0" DisableMacros="True" Enabled="True"
HideControlForZeroRows="True" HideOnSubPages="False" IsVisible="True" QueryStringKey="query" UseUpdatePanel="False" ZeroRowsText="No photos" />

User avatar
Kentico Support
Kentico Support
kentico_radekm - 2/2/2011 9:17:25 AM
   
RE:Add media gallery web parts to apsx template created with VS2010
Hello.

Could you please try to use Media gallery on your aspx page template as following article describes? http://devnet.kentico.com/Knowledge-Base/Media-Libraries/to-use-Media-gallery-web-part-on-ASPX-page-templat.aspx

I tested it and it works and contains all required properties. Thank you.

Best Regards,
Radek Macalik

User avatar
Member
Member
Mark - 2/2/2011 9:33:09 AM
   
RE:Add media gallery web parts to apsx template created with VS2010
I'll take a look at it.

I won't be working on these Kentico sites much longer as I have accepted a new position with promotion in another organization.

Thanks for all your help and support. If the new organization is looking for another solution, I will definitely bring it to their attention.

Thanks again,
Mark

User avatar
Kentico Support
Kentico Support
kentico_radekm - 2/2/2011 9:14:17 AM
   
RE:Add media gallery web parts to apsx template created with VS2010
Hello.

Unfortunately this functionality is not provided in current version. Cms:TreeFolder control don´t have such a functionality, however I submitted it as a feature request and we will consider it to some of future releases. Thank you.

Best Regards,
Radek Macalik