Copied to clipboard

Flag this post as spam?

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


  • Barry Fogarty 493 posts 1129 karma points
    Sep 21, 2011 @ 14:13
    Barry Fogarty
    0

    Media Picker property sets to zero when no image is set

    Hi Vladan, just wanted to check somethign with you.  May be related to my previous issue re type setting.  When I create a document via DocumentTypeBase.Save(), the media picker property is set to zero when there is no image to populate it.  This results in the backoffice UI saying 'Delete' as well as 'Choose; as I think it loads a value of 0 into the property.  Not a big deal but though I would make you aware and possibly a fix for the next update :-)

     

  • Vladan Ostojic 94 posts 210 karma points
    Sep 21, 2011 @ 14:45
    Vladan Ostojic
    0

    Hey Barry, if it is possible to have that media picker not set, did you set its type as "int?" (nullable int)? In that case it should save to database as null (not as 0). Currently it saves 0 as 0 is a valid (and default) value for an int.

  • Barry Fogarty 493 posts 1129 karma points
    Sep 21, 2011 @ 15:48
    Barry Fogarty
    0

    Worked like a charm Vladan, thank you!  I presumed as int? does not seem to work for member types it was the same for doc types.  Obviously not.  Off-topic, am I right in thinking uSiteBuilder does not have support for Upload data type?  Or if I upload a file to the server and get the path, can I save this into an Upload property and it will work OK?

    Really loving developing with Umbraco and uSiteBuilder, thanks again for such a useful tool.

  • Vladan Ostojic 94 posts 210 karma points
    Sep 21, 2011 @ 15:59
    Vladan Ostojic
    0

    You're welcome :). int? for some reason is not working correctly for member types so that's something that we are going to fix.

    About Upload data type, it should be supported but I didn't really test it:

     

            [DocumentTypeProperty(UmbracoPropertyType.Upload)]

            public string MyUploadProperty { get; set; }

    That will create a property of Upload type but I'm not sure when the page is being rendered what will be the value of that string. It is not possible to upload the file programatically via DocumentTypeBase.Save()
Please Sign in or register to post replies

Write your reply to:

Draft