1-888-365-2779
+1-888-365-2779
Try Now
More in this section

Forums / Developing with Sitefinity / How to Programmatically Delete a ControlPresentation Item

How to Programmatically Delete a ControlPresentation Item

3 posts, 1 answered
  1. Ronnie
    Ronnie avatar
    31 posts
    Registered:
    20 Jul 2011
    12 Dec 2011
    Link to this post
    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.

  2. Boyan Barnev
    Boyan Barnev avatar
    1429 posts
    Registered:
    16 Aug 2017
    15 Dec 2011
    Link to this post
    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
    Answered
  3. Ronnie
    Ronnie avatar
    31 posts
    Registered:
    20 Jul 2011
    15 Dec 2011
    Link to this post
    ..
    Yes That's how it should be done  !
    Tks.
3 posts, 1 answered