One way to do this is by hooking up the DataFactory.Instance.CreatingPage event. I'd probably do this in Application_Start in Global to avoid having the event being subscribed to multiple times. In the event handler you can check what type of page being created and set default values.
Ok, good idea!
So I'm hooked up on the CreatingPage event but how do I acually set the default values then? Do I treat it like a property or do I have to use the CategoryList's ResolveCategoryNames or something like that?
Thanks for you input!
Your event handler should look something like this (I only have a CMS 7 site to look at right now but it should be similar in CMS 6):
void Instance_CreatingPage(object sender, EPiServer.PageEventArgs e)
if (e.Page.PageTypeName == "<your value here>")
e.Page.Category.Add("<your int id here>");
If I where to do this I'd probably store the values (PageTypeName and Category) in a settings page so that the editor can modify them and perhaps set more then one category as default. I haven't tested the code but there shouldn't be much more to it...
Thanks Henrik, that worked like a charm!
I want to select a certain category(news) by default when I create a new page from a specific pagetype. Much like you can do with the properties through admin-mode where you can allow it to be preset. This is so the editors can't forget to check it.
Feels like it should be fairly simple task but I can't seem to find a simple solution.
How do I do this?