Пример #1
0
        protected override WebControl CreateControlInternal(Control container)
        {
            _checkBox = new DnnRadButton {ID = ID + "_CheckBox", ButtonType = RadButtonType.ToggleButton, ToggleType = ButtonToggleType.CheckBox, AutoPostBack = false};

            _checkBox.CheckedChanged += CheckedChanged;
            container.Controls.Add(_checkBox);

            //Load from ControlState
            if (!_checkBox.Page.IsPostBack)
            {
            }
            switch (Mode)
            {
                case CheckBoxMode.YN:
                case CheckBoxMode.YesNo:
                    var stringValue = Value as string;
                    if (stringValue != null)
                    {
                        _checkBox.Checked = stringValue.ToUpperInvariant().StartsWith("Y");
                    }
                    break;
                default:
                    _checkBox.Checked = Convert.ToBoolean(Value);
                    break;
            }

            return _checkBox;
        }
Пример #2
0
        protected override WebControl CreateControlInternal(Control container)
        {
            _checkBox = new DnnRadButton {
                ID = ID + "_CheckBox", ButtonType = RadButtonType.ToggleButton, ToggleType = ButtonToggleType.CheckBox, AutoPostBack = false
            };

            _checkBox.CheckedChanged += CheckedChanged;
            container.Controls.Add(_checkBox);

            //Load from ControlState
            if (!_checkBox.Page.IsPostBack)
            {
            }
            switch (Mode)
            {
            case CheckBoxMode.YN:
            case CheckBoxMode.YesNo:
                var stringValue = Value as string;
                if (stringValue != null)
                {
                    _checkBox.Checked = stringValue.ToUpperInvariant().StartsWith("Y");
                }
                break;

            default:
                _checkBox.Checked = Convert.ToBoolean(Value);
                break;
            }

            return(_checkBox);
        }