Copied to clipboard

Flag this post as spam?

This post will be reported to the moderators as potential spam to be looked at


  • Sotiris Mastrandrikos 6 posts 26 karma points
    Dec 18, 2018 @ 15:50
    Sotiris Mastrandrikos
    0

    DataTypeDefinition with custom property editor

    I'm trying to create a DataTypeDefinition using a custom property editor located in the "App_Plugins" folder. Here's the code:

      
    IContentTypeService cs = ApplicationContext.Current.Services.ContentTypeService;
    ContentType ct = new ContentType(paterntId);
    ct.Name = name;
    ct.Alias = alias;
    ct.AllowedAsRoot = allowedRoot;
    PropertyGroup tab = new PropertyGroup { Name = "Contents", SortOrder = 0 };
    ct.PropertyGroups.Add(tab);
    
    var cGridDtd = new DataTypeDefinition(-1, "ContentsGrid");
    ct.AddPropertyType(new PropertyType(cGridDtd), "Contents");   
    cs.Save(ct); 
    

    ContentsGrid is my custom property editor. I get the following error : "System.NullReferenceException: 'Object reference not set to an instance of an object."

    Any suggestions? Thanks in advance

Please Sign in or register to post replies

Write your reply to:

Draft