Copied to clipboard

Flag this post as spam?

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


  • Matt Taylor 859 posts 2052 karma points
    Mar 12, 2013 @ 17:13
    Matt Taylor
    0

    How to update the value of a 'radiobutton list' property in .Net

    I've some .Net code that updates a bunch of properties for a member using

    base.SetPropertyValue("lastname", value);

    I've just added a gender property using a radiobutton list

    1. Male (32)
    2. Female (33)

    I know the XML value should be something like <![CDATA[32]]> but I'm struggling to figure out how to update this new property. These all fail.

    1. base.SetPropertyValue("lastname", 32);
    2. base.SetPropertyValue("lastname", "Male");
    3. base.SetPropertyValue("lastname", "<![CDATA[32]]>");

    Regards,

    Matt

     

  • Matt Taylor 859 posts 2052 karma points
    Mar 12, 2013 @ 18:22
    Matt Taylor
    100

    My problem was that I was inheriting from ProfileBase and updating the properties like so.

    [SettingsAllowAnonymous(false)]
            public int gender
            {
                get
                {
                    var o = base.GetPropertyValue("gender");
                    if (o == DBNull.Value)
                    {
                        return 0;
                    }
                    return (int)o;
                }
                set
                {
                    base.SetPropertyValue("gender", value);
                }
            }

    I was trying to be clever and used an enumerated type for the property but it seems it didn't like that.
    String, Int & DateTime types are all OK.

  • This forum is in read-only mode while we transition to the new forum.

    You can continue this topic on the new forum by tapping the "Continue discussion" link below.

Please Sign in or register to post replies