November Happy Hour will be moved to Thursday December 5th.

MovingPage event does not work

Vote:
 
I cant get the MovingPage event to work. The page object contains nothing. What want to do is to limit the access to delete or move a page of a certain page type. This is done by accessing another page with GetPage, which has restricted read access (by using this method I have limited the ability to save successfully in the edit panel by using the EditPageValidators). In Application_Start event in Global.asax.cs I put: EPDataFactory.MovingPage += new PageEventHandle(OnMovingPage); The method: private void OnMovingPage(object sender, PageEventArgs e) { if(e.Page.PageTypeName=="Chapter") { try {PageData testpage = EPDataFactory.GetPage(new PageReference(237)); } catch { e.CancelAction = true; } } } Any help would be appreciated. Regards Christian
#17420
Jul 08, 2005 18:29
Vote:
 
You're right, the e.Page reference is uninitialized (have to check if this is a bug or just some performance thing). But the PageLink is valid, so you can do it like this: private void OnMovingPage(object sender, PageEventArgs e) { PageData movingPage = EPDataFactory.GetPage(e.PageLink); if (movingPage.PageTypeName == "Chapter") { // etc... } }
#18178
Jul 11, 2005 10:23
* 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.