Url property disappear when adding and publishing

Vote:
 

Am quite new to EpiSever so bare with me. 

I have two classes like this: 

namespace Whatever
{

  public class Link
    {
        [UIHint(UIHint.Image)]
        [Display(Name = "Image", Description = "", GroupName = SystemTabNames.Content, Order = 1)]
        public virtual ContentReference Image { get; set; }

        [Display(Name = "Link", Description = "", GroupName = SystemTabNames.Content, Order = 2)]
        public virtual Url LinkTo { get; set; }
    }

    [PropertyDefinitionTypePlugIn]
    public class LinksProperty : PropertyList<Link>
    {
       
    }
}

I've then created a block:

namespace Whatever.Models.Blocks
{
    [ContentType(DisplayName = "LogoBlock", GUID = ".......", Description = "")]
    public class LogoBlock : SiteBlockData
    {
        [CultureSpecific]
        [Display(
            Name = "LinksList",
            Description = "LinksList",
            GroupName = SystemTabNames.Content,
            Order = 1)]
        [EditorDescriptor(EditorDescriptorType = typeof(CollectionEditorDescriptor<Link>))]
        public virtual IList<Link> LinksList { get; set; }

    }
}

The above code creates a way to add a Link-Item but in EpiServer Editor when I add LinkTo and Image in Editor Mode and do publish the LinkTo-property disappears and I can't figure out why? 
Need help?

#205107
Jun 28, 2019 14:18
Vote:
 
using EPiServer.Cms.Shell.Json.Internal;
...
[JsonProperty]
[JsonConverter(typeof(UrlConverter))]
[Display(Name = "Link", Order = 2)]
public virtual Url LinkTo{ get; set; }


Probably has to do with json serialization which differs between frontend and backend. Try adding the above to get the same...

#205109
Jun 28, 2019 14:32
JoBo - Jun 28, 2019 14:34
Awesome!!! Big Thanks Daniel!
This topic was created over six months ago and has been resolved. If you have a similar question, please create a new topic and refer to this one.
* You are NOT allowed to include any hyperlinks in the post because your account hasn't associated to your company. User profile should be updated.