Copied to clipboard

Flag this post as spam?

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


  • Nathan Woulfe 447 posts 1664 karma points MVP 5x hq c-trib
    Sep 20, 2013 @ 05:03
    Nathan Woulfe
    0

    Saving DataEditorSettings on custom data type

    Based on the post at http://www.nibble.be/?p=97 I've created a usercontrol following the [DataEditorSetting()] syntax to define config items for the data type, but I'm unable to save changes to these.

    public partial class TestClass : System.Web.UI.UserControl, IUScontrolDataEditor {
    
       private string umbracoValue;
       public object value { 
           get {
               return umbracoValue; 
           } 
           set { 
               umbracoValue = value.ToString(); 
           } 
        }
    
        [DataEditorSetting("account ID:", defaultValue = "testID1234")]
        public string accountId { get; set; }
    
        protected void Page_Load(object sender, EventArgs e) {
            // since Page_Load isn't called when viewing the data type definition, there's nothing to see here - all I'm doing is serializing a string value that I then use in an ajax request
        }
    }
    

    If I manually updated the values in the DB, the data type reflects the changes, but trying to do so from the back office doesn't work, which makes me think I'm missing something - do I need to define the accessors for each editor setting?

  • Nathan Woulfe 447 posts 1664 karma points MVP 5x hq c-trib
    Sep 20, 2013 @ 05:17
    Nathan Woulfe
    0

    And no sooner do I post this, than I find the problem:

    [DataEditorSetting("account ID:", defaultValue = "testID1234")]
        public string accountId { get; set; }
    

    won't work, but

    [DataEditorSetting("accountId", defaultValue = "testID1234")]
        public string accountId { get; set; }
    

    works fine - having given the editor setting and associated property the same name, but I shouldn't have to do that, I wouldn't have thought? Should be fine to have multiple words in the editor setting name?

Please Sign in or register to post replies

Write your reply to:

Draft