Jamie Dixon
Web Developer, Software Engineer and Mixed Language Artist-
Visual Studio – Lost nesting of codebehind
Posted on April 30th, 2010 No commentsWe’ve all had times when we’ve created an ASP.NET webpage and then a new page is required with almost identical functionality.
I had that task today and so making things simple I copied the current files, pasted them and made the necessary changes to hook the designer and code-behind files to the aspx page.
This works perfectly. The code builds, the page runs, everything happens as I expected it to.
Then I noticed a little quirk in Visual Studio 2008. One of the great features of Visual Studio is the way in which it visually nests code-behind files in the Solution Explorer under your aspx file.
After making a copy of my origional page I noticed that my code-behind was left astray. I checked all the references to make sure everything was hooked up correctly but still, my code-behind wasn’t nesting nicely under my aspx page as usual.
Now I’m sure many people have come across this problem before however this was a first for me.
It turns out that the references are stores in the csproj file. There is a reference to the code-behind file and a list of dependancies. By default, when doing a copy/paste of files outside of Visual Studio, this reference is not updated and the code-behind file doesn’t attach itself to the aspx file in the Solution Explorer.
The solution is to simply add a reference to the dependant aspx fie in the csproj file like so:
<Compile Include="myShinyNewFile.aspx.cs"> <DependentUpon>myShinyNewFile.aspx</DependentUpon> <SubType>ASPXCodeBehind</SubType> </Compile>
Once you’ve added the second line into the csproj file, restarting visual studio brings back the much loved nesting.
-
Upgrading EPiServer to version 6
Posted on April 23rd, 2010 No commentsWith 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.InitializationModuleThe 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.
-
Global Resource strings by property
Posted on April 15th, 2010 No commentsEvery now and then I come across a bunch of string literals littered through out some code and begin the task of moving them out into their own resource file (.resx).
Gaining access to these strings from C# is pretty easy however I’m yet to find anywhere explaining it the way I find simplest.
Assuming your resx file is stored in the App_GlobalResources folder, you can basically assign your resource file to a variable in your C# using the following syntax:
using Res = Resources.MyResourceFile
This then gives you the ability to referene the contents of the resource file as properties in your code.
string x = Res.OneOfMyStringNames;
-
Stork – New Website is launched
Posted on April 12th, 2010 No comments
I received a lovely email this morning thanking me for my input and hard work on the development of the new Stork website.
“The brand is 90 years old this year and as part of the birthday celebrations we wanted to create a site which the new generation of bakers, inspired by the likes of Jamie Oliver and Nigella, could engage with and use as hub of knowledge for all things cake.”
You can visit the site at www.bakewithstork.co.uk
-
EpiServer – Page List Sort by Creation Date
Posted on April 7th, 2010 No commentsI 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:
epiPageList.SortOrder = EPiServer.Filters.FilterSortOrder.CreatedAscending; epiPageList.DataBind();
Here’s the full list of enum options available for sorting by SortOrder:
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 No commentsOne 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:
// 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).
-
Mmm…Mattessons
Posted on March 15th, 2010 No comments
Today is the day… Two fast (and sausages filled) weeks later and we’re ready for the launch of the new Mattessons website.
Our deadline for this project was determined by a new TV ad that’s coming out today and so the flexibility in timings was somewhat limited.
We decided to use Wordpress for this project which means this is also my first commercial project on the WAMP stack. The decision to go with Wordpress was based on a few different criteria, the first being…time.
Anyone who’s been working with Wordpress for any period of time will know how fast it can be to get a site up and running in no time at all. The time investment comes when you’re developing a complete custom template…enter Mattessons!
As the lead developer on the Mattessons project I had to make some calls as to what amount of content management we were going to be offering to our client. The more they were able to manage, the longer it’d take in the development process. My decisions mostly revolved around the idea of “Lets do what we can to give them control over all content items”.
We did this by employing some nice use of custom fields, the creation of a very basic custom markup language for inserting custom property values into page copy and by creating a system where pages themselves can be pulled into other pages and displayed as promos/previews.
You’ll notice on the homepage of the new website that there are currently two promos being displayed. These promos are pages in themselves, just as are the products in the Our Range section and the footer items.
Wordpress makes it really easy to get information about the current page and it’s child pages which enabled us to create a basic yet powerful hierarchy of products and product ranges. We’re also using a great plugin for relating pages to one another in a more lateral way. This again is being used in a slightly different way than standard by pulling out information on related pages and then obtaining those page details through the standard Wordpress API.
All-in-all this has been a really fun project to work on. It’s been fast paced with a quick turn around and it’s been a joy working with a talented team of managers, designers, QAs and front end developers.
What can I say… “It’s a Primal Thing”.
-
1000 Reputation on StackOverflow
Posted on December 10th, 2009 No comments
Today I hit the 1000 reputation points mark on StackOverflow.Reputation points are given by other users of StackOverflow for giving good answers to other peoples questions and for asking good questions yourself.
I’m a big fan of peer review and reaching the 1000 reputation points mark is a real milestone in my own quest to help other programmers and to ask good questions.
Here’s to the next 1000 !
-
Shower? That’ll be £30 please!
Posted on September 4th, 2009 8 commentsWhen was the last time you paid your hard earned money to take a shower? (do we even call it ‘taking’ a shower in this country? Should I say ‘have’ a shower?)

The journey to and from work has been part and parcel of working away from home since the beginning of mankind.
Ever since my second real job, I’ve taken either public transport or driven. I think there comes a time in every persons life when they realise they’re not quite as fit as they’d like to be and for me, that time is now.
As a result of this I made a decision to start cycling to work. Boris would be proud!
I set out and bought myself a new bicycle, helmet, bike lock, new snap proof pedals (since the plastic ones on the bike snapped off after I ‘tested’ the bike at the weekend) and various bits and bobs including a pump and mudguard (this got very expensive, very quickly!).
My route to work takes me through some lovely parts of London including Putney, Wimbledon, and across the River Thames over a distance of 8.9 miles.
18 miles a day, that’s bound to help increase my fitness and keep the old endorphins flowing. Right?
The only problem is, there are no showering facilities at work! I hear your cries, agast with the anguish of having to sit at work all day smelling like a 4 day dead hedgehog lying by the side of a summers road during a heat wave. So what’s a guy to do?
My first thought was that a quick wash in the sink would suffice. This may indeed be the answer and I’ve certainly not ruled it out.
I had this conversation with another potential cyclist at work and I presented my ideas of the sink wash to an unenthusiastic “yeah, you could do that, I guess”.
My second idea involved scouting out other local businesses and finding one with showering facilities. I figured I could just walk into an office each day, greet them with the usual “Good morning, nice to see you again, love what you’ve done with your hair today”, and proceed to shower and scoot.
It was at this point I was presented with a third option by my new cycling friend. “Why don’t we join the gym over the road so we can use their showers? It’s only £30 a month so you’d only have to cycle 10 days each month to have earned that back in saved transport costs.”
I like the idea of being able to have a nice warm shower each morning after a lengthy ride to work, but £30 a month to shower? That seems just a little backwards to me.
Instantly I responded with “What a great idea! Do you think we can convince them to let us just use the showers for free?”. Those who know me wont be surprised that this was my initial reaction. “Payment you say? How about a lifetimes free trial? yes? yes?”.
Usually when I sugest anything that involves negotiating or being a bit cheeky I’m met with groans and smug looks that sugest “You sunny, don’t know the system like the rest of us do, such innocence”. Yes, indeed.
So what would you do in this situation? Would you pay £30 a month to shower? Try to negotiate a fair rate to use the gym’s showers in the morning? Infiltrate other local businesses? or go for the old strip wash in the sink?
Answers on a postcard…(By ‘answers’ I mean comments and by ‘postcard’ i mean in the little box below).
-
A new project begins – StatPro
Posted on August 18th, 2009 No comments
Good news! Good for me anyway. During my recent search for a new project and team to work with, I’ve been invited to join the team at StatPro in Wimbledon, working as their SaaS Web Developer.
The role looks very interesting and I’ve been told I’ll be working on a new greenfield project using ASP.NET MVC (C# 3.5+).
Here’s a little bit about StatPro from their website:
StatPro is a leading provider of portfolio analytics and data solutions for the global asset management industry. Having grown from a one-product company StatPro now offers our clients eight core products including data and enterprise reporting solutions. This range of products enables StatPro to provide a unique integrated product offering with a strong competitive advantage.
One of the most important things to me in any company I work with is their passion and desire to firstly, allow the business and it’s staff run in an adaptive and progressive manner, and secondly for them to embrace new technologies as they arise.
StatPro are one of the first companies I’ve seen to be commercially utilising ASP.NET MVC and as someone passionate about new technology and innovation, this really hits my hot buttons. The company have also embraced many of the agile processes and are actively bringing in more Unit Testing and TDD methodologies. Working in iterative cycles also ticks at least one of the boxes and having worked this way before, it comes as a real pleasure to be involved with a company who know what works well.
Finding out what works from both the companies perspective (what value is offered to the business) and also the staff’s perspective (what can I realistically achieve in any given period of time) is a great place to start from and keeps the whole inner workings of the development and business processes transparent.
Throughout my time at StatPro I’ll be blogging about my continued learning’s of ASP.NET MVC, C# 3.5, Web Development and general musings into the life of the nine-to-five London worker.
Luckily I’ll be able to cycle to work from now on and avoid the tube which will be a nice change and might even help get me back to being fit once again. Hey, who knows, perhaps soon I’ll be blogging about keeping trim and attending lunch time yoga classes (It’s a nice idea huh? :p ).


