Save/publish doesn't work with image url property

Vote:
 

Hello, all!

I'm wondering what I'm doing wrong here. I have a simple page type in EpiServer 7 which is causing me headaches. Here's the code (I changed properties' names a bit).

    [ContentType(DisplayName = "SimplePage", GUID = "02e235cb-dc6b-4ed7-8827-c481c6f7df98", Description = "")]
    public class SimplePage : PageData
    {
        [Display(
            Name = "Foo 1",
            Description = "",
            GroupName = SystemTabNames.Content,
            Order = 20)]
        public virtual PageReference Foo1 { get; set; }

        [Display(
            Name = "Foo 2",
            Description = "",
            GroupName = SystemTabNames.Content,
            Order = 30)]
        public virtual bool Foo2 { get; set; }

        [BackingType(typeof(PropertyImageUrl))]
        [Display(
            Name = "Image",
            Description = "",
            GroupName = SystemTabNames.Content,
            Order = 40)]
        public virtual string Image { get; set; }

        [Display(
            Name = "Foo 3",
            Description = "",
            GroupName = SystemTabNames.Content,
            Order = 50)]
        public virtual XhtmlString Foo3 { get; set; }
    }

The strange thing is that everything else works fine but not storing the Image property's value. So Foo1, Foo2, Foo3 is stored OK but not Image property.

Problem occurs when I try to publish the simplepage. Episerver doesn't give me any errors but if I close the browser and reopen the simplepage Image property is empty even though it had value before publishing. Sometimes autosave gives me "offline, can't save" error, or at least I think it's the autosave, anyway I can still publish changes to other properties but not Image.

Now if I remove Image property from the code and create it using Admin view it works fine. This implies that there must be something wrong in my code but can't figure out what...

Any help would be greatly appreciated.

 

-Marko

#63626
Nov 22, 2012 14:44
Vote:
 

Change the type of the image from string to Url:

public virtual Url Image { get; set; }

#63627
Edited, Nov 22, 2012 15:13
Vote:
 

Hi! Thanks. That worked.

I tried to mark your answer as "mark as answer" but got a nice little ASP.NET error page for response :)

-Marko

#63630
Nov 22, 2012 16:01
This thread is locked and should be used for reference only. Please use the Episerver CMS 7 and earlier versions forum to open new discussions.