How to Programmatically Delete a ControlPresentation Item

Posted by Community Admin on 04-Aug-2018 17:27

How to Programmatically Delete a ControlPresentation Item

All Replies

Posted by Community Admin on 12-Dec-2011 00:00

Hello,

Need to complement my module installation and update process with deletion and update of control templates.

Right now I'm using to create the templates:
var template = PageManager.GetManager().CreatePresentationItem<ControlPresentation>(Guid.NewGuid());
template.DataType = ...
template.EmbeddedTemplateName = ....
template.Name = ...
template.ControlType = ...
.....

How can I Delete using similar API calls..

Thanks for your help.

Posted by Community Admin on 15-Dec-2011 00:00

Hello Ronnie,

The Delete() method of PageManager has an overload accepting PresentationData item, so you can just pass it as an argument, and then call SaveChanges() to commit the transaction.

Kind regards,
Boyan Barnev
the Telerik team

Do you want to have your say in the Sitefinity development roadmap? Do you want to know when a feature you requested is added or when a bug fixed? Explore the Telerik Public Issue Tracking system and vote to affect the priority of the items

Posted by Community Admin on 15-Dec-2011 00:00

..
Yes That's how it should be done  !
Tks.

This thread is closed