Developer forum

Forum » Templates » Delete page from frontend in DW9

Delete page from frontend in DW9

Hans Ravnsfjall
Hans Ravnsfjall
Reply

What am I doing wrong? I am trying to delete a page from a template like this

 
Dynamicweb.Content.IPageService.DeletePage(ID);
 

Where the ID is the INT id of the page, but i get the message saying

 An object reference is required for the non-static field, method, or property 'IPageService.DeletePage(int)'

 

 

 

In dynamicweb 8, i have implemented it like this

Dynamicweb.Content.Page.GetPageById(ID).Delete();

and it works fine, but how do i do this in DW9?

 

/Hans

 


Replies

 
Hans Ravnsfjall
Hans Ravnsfjall
Reply

Again, nevermind

 

Not sure why my first try isnĀ“t workning, but found out this works

Dynamicweb.Services.Pages.DeletePage(ID);

 

You must be logged in to post in the forum