More in this section
Forums / Sitefinity SDK / Boolean field in custom module

Boolean field in custom module

The forums are in read-only mode. In case that you want to directly contact the Progress Sitefinity team use the support center. In our Google Plus group you can find more than one thousand Sitefinity developers discussing different topics. For the Stack Overflow threads don’t forget to use the “Sitefinity” tag.
2 posts, 0 answered
  1. jocelyn payneau
    jocelyn payneau avatar
    51 posts
    07 Dec 2009
    22 Feb 2011
    Link to this post

    I have a boolean property myField.

    In the insert/edit form, I placed a choicefielddefinitionelement. I create a new item, checked the checkbox and save. When I edit an item, the checkbox is not selected but in the database, the value is well saved (set to 1).

    Here is my code:
    private bool myField;
            public bool MyField
                get { return this.myField; }
                set { this.myField= value; }
    var myFieldElement = new ChoiceFieldElement(mainSection.Fields)
                    ID = "myFieldElementControl",
                    FieldType = typeof(ChoiceField),
                    DataFieldName = "MyField",
                    DisplayMode = displayMode,
                    MutuallyExclusive = false,
                    RenderChoiceAs = RenderChoicesAs.SingleCheckBox,
                    CssClass = "sfCheckBox sfFormSeparator",
                    Title = (displayMode == FieldDisplayMode.Read) ? "Active?" : string.Empty,
                    Description = "Description of myFieldElement",
                    WrapperTag = HtmlTextWriterTag.Li
                ChoiceElement item = new ChoiceElement(myFieldElement.ChoicesConfig)
                    Text = "Active?"

    Do you have any idea of what could cause this issue?

  2. Pepi
    Pepi avatar
    981 posts
    31 Jan 2017
    24 Feb 2011
    Link to this post
    Hi jocelyn payneau,

    You need to copy the specific property in the manager Copy method (this is needed for the purposes of the Content Lifecycle):

    Copy Code
    public void Copy(ProductItem source, ProductItem destination)
        destination.MyField = source.MyField;

    Let us know if this solves the described issue.

    Best wishes,
    the Telerik team
    Registration for Q1 2011 What’s New Webinar Week is now open. Mark your calendar for the week starting March 21st and book your seat for a walk through all the exciting stuff we ship with the new release!
2 posts, 0 answered