You are currently browsing the monthly archive for February 2008.
I have just passed the EPiServer CMS 5 certification! Together with one of my colleagues we were the first in Gothenburg to do the new certification test for CMS 5(at Cornerstone anyway). My colleague, Andreas Hansson, also passed the test. Congratulations!
I had some problems today getting a PageCollection sorted by the “StartPublish”-property. After some digging, I found out that the page property-names should be prefixed by “Page”. So instead of sorting by “StartPublish” I should’ve sorted by “PageStartPublish” all along.
FilterPropertySort sorter = new FilterPropertySort("PageStartPublish", FilterSortDirection.Descending);
pagesCollection.Sort(sorter);
After som searching i found this EPiServer forum thread that show how to create a custom property in CMS 5. Not rocket sience, but I like to have one place to find code samples that will speed up my work. With this new blog I have just such a place
using System;
using System.Collections.Generic;
using System.Text;
using EPiServer;
using EPiServer.Core;
using EPiServer.DataAbstraction;
using EPiServer.PlugIn;
using EPiServer.Web.PropertyControls;
using System.Web.UI.WebControls;namespace EPiServerDemo.PropertyTypes
{
/// <summary>
/// Custom PropertyData implementation
/// </summary>
[Serializable]
[PageDefinitionTypePlugIn(DisplayName="My demo dropdown")]
public class MyDropDownCore : EPiServer.Core.PropertyString
{
public override IPropertyControl CreatePropertyControl()
{
return new MyDropDownPropType();
}
}
public class MyDropDownPropType : EPiServer.Web.PropertyControls.PropertySelectControlBase
{
protected override void SetupEditControls()
{
base.SetupEditControls();DropDownList inputControl = this.EditControl;
inputControl.Items.Add("Red");
inputControl.Items.Add("Blue");
inputControl.Items.Add("Green");
inputControl.SelectedValue = this.PropertyData.Value as string;
}
}
}
In .Net 3.0 you use the ConfigurationManager class, found in the System.Configuration namespace, to get a hold of your applications configuration. You need to make a reference to the System.Configuration.dll
To get your AppSettings, use the following line of code:
string MyString = System.Configuration.ConfigurationManager.AppSettings["keyname"].ToString();
To get you connection strings, use:
string connString = ConfigurationManager.ConnectionStrings["connstr"].ConnectionString;
and add one node in web.config:
<connectionStrings>
<add name="connstr" connectionString=""/>
</connectionStrings>
Found out today that after a few hours of searching that there is a bug in the version (CMS 5) of EPiServer we use in one of our projects. When using additional querystring parameters one should turn of the caching of EPiServerFriendlyUrlRewriteProvider, with this row in web.config:
<add name="EPiServerFriendlyUrlRewriteProvider" description="EPiServer standard Friendly URL rewriter" type="EPiServer.Web.FriendlyUrlRewriteProvider,EPiServer" friendlyUrlCacheAbsoluteExpiration="0:0:0" />
This bug has been fixed in CMS 5 SP1, so it might be a good idea to upgrade
