I am looking for some help in figuring out an appropriate approach to this setup.
I have a Sitecore tree that looks something like this:

  • content
    • settings
    • home
      • potato
        • spud1
        • spud2

The settings node has a droplink field that points to the potato item. I have a POCO model that roughly looks like this:

[SitecoreType( AutoMap=true, TemplateId="1234..." )]
public class ModelA {
   public virtual Guid Id { get; set;}
   public virtual String Name { get; set; }
   public virtual ModelB Potato { get; set; }

[SitecoreType( AutoMap=true, TemplateId="1235..." )]
public class ModelB {
   public virtual Guid Id { get; set;}
   public virtual IEnumerable<Spud> Children { get; set; }

While the general rendering behaviour of this setup seems fine, we're having some issues trying to get an edit frame where we can add a new spud3 to the list of spuds.

The current setup has been centered around:

@using( BeginEditFrame( Model, "Title", m => m.Potato ) ) {}

but this isn't really doing what we want (haven't got exactly what it's not doing at hand as I'm posting on behalf of someone, but will update in 12hrs time with additional detail).

Assuming what we're trying to do is reasonable, can anyone spot the issue in the setup above?

We've also noticed a (probably known) bug where if the last 2 (supposedly optional) arguments of the BeginEditFrame() method are omitted a NullReferenceException is thrown from Sitecore's WebControl::GetItem().
[Note please @MikeEdwards if you're reading this ;)]

1 Answer 1


Can you change this to use datasources? If you did that then the rendering would point to potato as its datasource. You would add the Insert web edit button to your rendering's Experience Editor Buttons field.

If it isn't possible then try changing your edit frame code to pass in the insert button. You should create a custom folder under /sitecore/content/Applications/WebEdit/Edit Frame Buttons in core and duplicate the insert button into it (the insert button is located at /sitecore/content/Applications/WebEdit/Edit Frame Buttons/Default/Insert). Then you would pass in your datasource item and the button folder's id to the edit frame:

@using(Html.BeginEditFrame(Model.Potato.Id, {Your_Custom_Button_Folder}) ) {}

  • An interesting idea. Will investigate this further. I've since found out that the frame that comes up seems to target the DropLink field rather than its children, which makes sense I suppose, but isn't what we want. I'm a little surprised custom code is needed for this; seems like something most people would want to do at some point. We use this pattern all the time. Commented Aug 24, 2017 at 14:15
  • You're not wrong with how it is set up. The rendering will use the current context item to determine what to target. This means if you populate the rendering's data source with the item potato then it should target the item you would expect. Otherwise you are stuck using an edit frame and passing it the id or path of the item you want to target.
    – Teeknow
    Commented Aug 24, 2017 at 14:31
  • 1
    You can have Glass target the children, if for example you render the Children in a foreach loop then you can BeginEditFrame(child, "Title", c => c.SpudField) as long as the Spud model has a [SitecoreId] set. This works for Edits, not sure about Inserts off top of my head... Looks like @Teeknow method would work though
    – jammykam
    Commented Aug 24, 2017 at 18:41
  • @jammykam correct that does allow editing the current item but they need the parent item if they want to add items that will be siblings to those items
    – Teeknow
    Commented Aug 28, 2017 at 13:51

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Not the answer you're looking for? Browse other questions tagged or ask your own question.