-
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


