London Dev Meetup Rescheduled! Due to unavoidable reasons, the event has been moved to 21st May. Speakers remain the same—any changes will be communicated. Seats are limited—register here to secure your spot!

Add custom code to page type save

Vote:
 

hi

Wanted to know how i can attach a function to the save page event and write my custom

code

 

tried to overide the save page but it worked for one time and now nada

 using CMS 5 R2 SP2

 

#31876
Aug 13, 2009 13:32
Vote:
 
any1 ?
#31954
Aug 18, 2009 12:47
Vote:
 

DataFactory.Instance has the events you are looking for.

First, register for this event in Application_Start to add initialization code in your app:

EPiServer.Web.InitializationModule.FirstBeginRequest

In that event, then attach to this event and do your magic from there:

EPiServer.DataFactory.Instance.SavingPage

 

#31985
Aug 19, 2009 11:08
Vote:
 

10x for the replay.

question:

when i attach to this event it is in the global.asax and not in my page type

how do i get this handler to my page type also

 

#31995
Aug 19, 2009 14:16
Vote:
 

The event args contains the page being saved.

 

#31996
Aug 19, 2009 14:28
Vote:
 

The eventhandler of the saving is called in the global asax and i want the event handler in my page where the developer will write the code.

i can check the page type in global asax but i want just the single page type to get the save event

 

#32002
Aug 19, 2009 15:07
Vote:
 
I am not sure I understand what you mean with having the "in my page". Are you refering to the webform template or ?
#32004
Aug 19, 2009 15:30
Vote:
 

Webform ( the aspx ) is the same in the template, no ?

the Scenarioio is -> i want to get values from serverl properties and save them in an external DB

when the content editor saves the page

 

 

#32011
Aug 19, 2009 16:26
Vote:
 

Ah ok, I mean the event handler can be a static method in any class so you can put it anywhere you feel is best in your solution. You just need the bootstrap in Application_Start since it is global and should only be initialized once.

 

#32012
Aug 19, 2009 16:45
* You are NOT allowed to include any hyperlinks in the post because your account hasn't associated to your company. User profile should be updated.