Web Developer, Software Engineer and Mixed Language Artist
RSS icon Email icon Home icon
  • Upgrading EPiServer to version 6

    Posted on April 23rd, 2010 Jamie 3 comments

    With the new EPiServer 6 now available to the masses, upgrading current EPiServer sites is something we’ve all been looking forward to.

    I was tasked this week with upgrading a pretty large website we’ve current got in EPiServer 5.2.375.236.

    There’s a nice little upgrade utility that comes with the EPiServer Deployment Center and this was my first port of call. I knew there’d be more to it than simply using the upgrade wizard however this handy utility did the majority of the work.

    I then headed over to the EPiServer CMS folder on my local machine to grab the required DLLs from the “6.0.530.0″ folder, dropped these into my websites DLL folder and updated all my references in Visual Studio. Bingo! Right? Well almost.

    After running the project for the first time I came across the following error message:

    Cannot resolve dependencies for the following module(s)
    EPiServer.Cms.Shell.UI.InitializableModule
    EPiServer.Cms.Shell.UI.InitializableModule
    EPiServer.Web.InitializationModule
    EPiServer.Web.InitializationModule

    The error is quite clear and I knew that some dependancies were missing, I just didn’t know which ones.

    After some digging around and much testing, it turns out that not all of the required DLLs are present in the “6.0.530.0″ folder (C:\Program Files\EPiServer\CMS\6.0.530.0 – on my machine).

    Doing a quick *.dll search in the CMS folder I found a zip file containing a full EPiServer project with a complete bin folder (C:\Program Files\EPiServer\CMS\6.0.530.0\VSTemplates\EPiServerProject.zip – on my machine).

    This bin folder contains 35 dlls where as the “6.0.530.0/bin” folder only contains 26 dlls.

    Copying all of these new dlls to my DLLs folder, updating my references in Visual Studio once more and running the project now works as expected :-)

    EPiServer 6 is looking really slick and the admin panel has improved hugely.

    I’m hoping that this post will be of help to all EPiServer developers finding they have the same problem. Having searched Google for a good couple of hours yielding no helpful results on this one, I hope this post will be of much help.

  • EpiServer – Page List Sort by Creation Date

    Posted on April 7th, 2010 Jamie No comments

    I had the delightful task today of sorting an EPiServer PageList control by creation date.

    The EPiServer documentation was of little help except in pointing out the SortOrder property. After some more searching around, I found that this property can be populated by the EPiServer.Filters.FilterSortOrder enum.

    Here’s a quick example:

    ?View Code CSHARP
    epiPageList.SortOrder = EPiServer.Filters.FilterSortOrder.CreatedAscending;
    epiPageList.DataBind();

    Here’s the full list of enum options available for sorting by SortOrder:

    ?View Code CSHARP
    EPiServer.Filters.FilterSortOrder.Alphabetical
    EPiServer.Filters.FilterSortOrder.ChangedDescending
    EPiServer.Filters.FilterSortOrder.CreatedAscending
    EPiServer.Filters.FilterSortOrder.CreatedDescending
    EPiServer.Filters.FilterSortOrder.Index
    EPiServer.Filters.FilterSortOrder.None
    EPiServer.Filters.FilterSortOrder.PublishedAscending
    EPiServer.Filters.FilterSortOrder.PublishedDescending
    EPiServer.Filters.FilterSortOrder.Rank
  • EPiServer – Unpublished page custom properties

    Posted on March 25th, 2010 Jamie No comments

    One of the things I recently discovered about our EPiServer configuration is that quite often we have pages associated with our current page, that haven’t yet been published.

    An example of this is when we have a Press Release and other associated press releases that show up in a side bar.

    For live, this is fine because we don’t want unpublished items showing up in the list however in edit mode, our content team need to see that the items they’ve associated, work as expected.

    The error that we’ve encountered is in edit mode, for each associated press release, if the press release was unpublished we weren’t getting the custom properties for that page (in code), even though the rest of the page object was as expected.

    The reason for this is that EPiServer only seems to bring back the custom properties for pages that have been published.

    So how do we go about obtaining a full page object for pages which are yet to be published?

    This is how we did it:

    ?View Code CSHARP
    // If the page is not yet published.
    if (page.PendingPublish)
    {
        // Check if we're in edit mode
        SystemPageBase basePage = Page as SystemPageBase;
        if (basePage != null)
        {
             PageReference reference = new PageReference(pageId);
     
             // Get the individual Master Language Branch based on the reference above.
             PageVersion pageVersion =  PageVersion.List(reference)
                             .Where(m => m.IsMasterLanguageBranch).FirstOrDefault();
             if (pageVersion != null)
             {
                  page = DataFactory.Instance.GetPage(pageVersion.ID);
             }
        }
    }

    As a side-note, this also alerted us to the fact that page IDs in EPiServer are not always of type Int32. Usually when an Id comes back from EPiServer we can parse it as an int however the IDs that come back from page versions, actually include an underscore (i.e. they’re strings).