Home

Always check if e.Page is null in DataFactory events

By Johan Pettersson 14 November 2011 11:03

If you’re listening to DataFactory events like:

protected void Application_Start(object sender, EventArgs e)
{
    EPiServer.DataFactory.Instance.CreatingPage 
        += new EPiServer.PageEventHandler(CreatingOrSavingPage);

    EPiServer.DataFactory.Instance.SavingPage
        += new EPiServer.PageEventHandler(CreatingOrSavingPage);
}

Always check if Page is null in PageEventsArgs. If we're copying a page in edit mode the Page will be null in one of the events!

I've updated the code for my dynamic content fix, check on line 3 in CreatingOrSavingPage.

Posted in EPiServerTags

PermalinkComments (0)

How to set a page updated programmatically

By Johan Pettersson 13 November 2011 17:43

If you want to mimic the “Mark page as changed”-checkbox in code it's not so obvious how to do that.

Read more...

Posted in EPiServerTags

PermalinkComments (0)

Country custom property

By Johan Pettersson 11 November 2011 17:51

Give your editors the possibility to select a country from a drop down list.

Read more...

Creating a hierarchal menu in EPiServer

By Johan Pettersson 1 November 2011 16:44

Lately I’ve seen different ways of creating a menu with correct and semantic html in EPiServer. The example in the EPiServer SDK is just soooo wrong from most perspectives. I think this is the best and simplest way:

Read more...

Browse by

Tags

Dates

2012
February (1)
2011
November (4)
October (1)
2009
December (4)
November (2)
October (1)