MovingPage event does not work

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
Mar 25, 2008 19:33
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... } }
Mar 25, 2008 19:43
* 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.