+1-888-365-2779
Try Now
More in this section

Forums / Developing with Sitefinity / Custom Control and RadComboBox

Custom Control and RadComboBox

2 posts, 1 answered
  1. Martin
    Martin avatar
    22 posts
    Registered:
    27 Sep 2013
    28 Nov 2013
    Link to this post
    Hi

    I've setup a custom control in a class libary.
    In the Designer.ascx template I have a RadComboBox.

    The ComboBox has 3 values: Red - 0 Green - 1 Blue - 2

    When editing a back-end page:
    I Edit the control, the correct combobox Value is selected
    However the selected text(index) is always sat on the first item....
    On Save the correct value is persisted to the Property data.

    For Example:
    If the property value is 2...
    The SelectedValue is set correctly to 2-Blue
    The initially selected item displayed is Red

    This is part of the JS code for the designer:

        // loads the current control settings
        refreshUI: function () {
            var data = this._propertyEditor.get_control();
            this.get_comboBoxControl().set_value(data.MyComboProperty);
        },
        // called when user clicks save button
        applyChanges: function () {
            var controlData = this._propertyEditor.get_control();
            controlData.MyComboProperty = this.get_comboBoxControl().get_value();
        }

    Any help appreciated

    Regards

    Martin
  2. Martin
    Martin avatar
    22 posts
    Registered:
    27 Sep 2013
    28 Nov 2013 in reply to Martin
    Link to this post
    Figured it out!

    Can't use:
    this.get_comboBoxControl().set_value(data.MyComboProperty);

    Must use:
    this.get_comboBoxControl().findItemByValue(data.MyComboProperty).select();

    Regards

    Martin
    Answered
2 posts, 1 answered