AI OnAI Off
Hi,
If I understand you correctly, you want to listen to content events and do something when a page is created or when a page is updated. You can do that by listening to events in either Global.asax or an initializable module.
protected void Application_Start(object sender, EventArgs e) { var events = ServiceLocator.Current.GetInstance<IContentEvents>(); events.CreatedContent += CreatedContent; events.SavedContent += SavedContent; } void CreatedContent(object sender, ContentEventArgs e) { } void SavedContent(object sender, ContentEventArgs e) {
Oh sorry, my code was for EPiServer 7 and not 6. This will work in 6:
protected void Application_Start(object sender, EventArgs e) { DataFactory.Instance.CreatedPage += CreatedPage; DataFactory.Instance.SavedPage += SavedPage; } void CreatedPage(object sender, PageEventArgs e) { } void SavedPage(object sender, PageEventArgs e) { }
I want to call a function if current page is newly created. and if it is already created then i want to call someother function. Can anyone help to get ridd off by this situation. Thanks !