Boolean field in custom module - Front- & Back-End Development - Front- & Back-End Development - Progress Community
 Front- & Back-End Development

Boolean field in custom module

  • Boolean field in custom module
  • Hello,

    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?

  • 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!