Sign Up

Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.

Have an account? Sign In

Have an account? Sign In Now

Sign In

Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.

Sign Up Here

Forgot Password?

Don't have account, Sign Up Here

Forgot Password

Lost your password? Please enter your email address. You will receive a link and will create a new password via email.

Have an account? Sign In Now

You must login to ask a question.

Forgot Password?

Need An Account, Sign Up Here

Please briefly explain why you feel this question should be reported.

Please briefly explain why you feel this answer should be reported.

Please briefly explain why you feel this user should be reported.

Sign InSign Up

The Archive Base

The Archive Base Logo The Archive Base Logo

The Archive Base Navigation

  • SEARCH
  • Home
  • About Us
  • Blog
  • Contact Us
Search
Ask A Question

Mobile menu

Close
Ask a Question
  • Home
  • Add group
  • Groups page
  • Feed
  • User Profile
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Buy Points
  • Users
  • Help
  • Buy Theme
  • SEARCH
Home/ Questions/Q 7607851
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 31, 20262026-05-31T00:46:13+00:00 2026-05-31T00:46:13+00:00

Does anyone know how to remove the renderings from a Sitecore item? I want

  • 0

Does anyone know how to remove the renderings from a Sitecore item?

I want to remove all of the sublayouts so I can replace them with a new set.
I have tried this but it does not seem to work. Nothing changes on the item.

I appear to be able to get the renderings like this:

RenderingReference[] renderings = item.Visualization.GetRenderings(Sitecore.Context.Device, true);

But there appears to be no way to then set them.

I can also get the renderings like this (from the link above):

LayoutDefinition layoutDefinition = LayoutDefinition.Parse(LayoutField.GetFieldValue(item.Fields[Sitecore.FieldIDs.LayoutField]));
DeviceDefinition device = layoutDefinition.GetDevice(Sitecore.Context.Device.ID.ToString());

if (device.Layout != null) device.Layout = null;
if (device.Renderings != null) device.Renderings = new ArrayList();

But again this does not work. Clearing the device from the layoutDefinition and setting the modified one has led to this exception: No connection could be made because the target machine actively refused it. And I now cannot view the item at all!

I feel like I’m barking up the wrong tree, any ideas?

Using Sitecore 6.4

UPDATE Re: techphoria414

Code I tried:

layoutDefinition.Devices.Clear();
layoutDefinition.Devices.Add(device);
  • 1 1 Answer
  • 0 Views
  • 0 Followers
  • 0
Share
  • Facebook
  • Report

Leave an answer
Cancel reply

You must login to add an answer.

Forgot Password?

Need An Account, Sign Up Here

1 Answer

  • Voted
  • Oldest
  • Recent
  • Random
  1. Editorial Team
    Editorial Team
    2026-05-31T00:46:14+00:00Added an answer on May 31, 2026 at 12:46 am

    I think your exception is unrelated. To actually save your changes, you need to edit the item. Be sure you always access and update the value throgh LayoutField.Value.

    LayoutField layoutField = new LayoutField(item.Fields[Sitecore.FieldIDs.LayoutField]);
    LayoutDefinition layout = LayoutDefinition.Parse(layoutField.Value);
    //make your changes to the LayoutDefinition here
    item.Editing.BeginEdit();
    layoutField.Value = layout.ToXml();
    item.Editing.EndEdit();
    
    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

Does anyone know of a method to remove all webapps deployed from .war files
Does anyone know how I can remove the address bar from the Android browser
Does anyone know how I would remove all leading zeros from a string. var
Does anyone know how I can remove links from the top menu using local.xml.
Does anyone know how to remove Treeitems from a Treechildren node in ZK? I
as the question says...does anyone know how I can remove these files? I didn't
does anyone know of a good regular expression to remove events from html. For
Does anyone know if it's possible to remove the topbar from a UITableView in
Does anyone know how to remove an entire column from a data.frame in R?
Does anyone know how (or process) to remove comments from Java class file at

Explore

  • Home
  • Add group
  • Groups page
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Users
  • Help
  • SEARCH

Footer

© 2021 The Archive Base. All Rights Reserved
With Love by The Archive Base

Insert/edit link

Enter the destination URL

Or link to existing content

    No search term specified. Showing recent items. Search or use up and down arrow keys to select an item.