Home

Always check if e.Page is null in DataFactory events

By Johan Pettersson 14 January 2010 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 January 2010 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)

Browse by

Tags

Dates

2010
August (1)
April (2)
January (2)
2009
December (4)
November (2)
October (1)