Esempio n. 1
0
 internal override void MergeCheckBoxAttributes(TagBuilder tag, RenderContext context)
 {
     base.MergeCheckBoxAttributes(tag, context);
     if (CheckedValue == null)
     {
         throw new XamlException("The CheckedValue attribute is required for Radio");
     }
     tag.MergeAttribute("value", CheckedValue.ToString());
 }
Esempio n. 2
0
        internal override void MergeCheckBoxAttributes(TagBuilder tag, RenderContext context)
        {
            base.MergeCheckBoxAttributes(tag, context);
            var chv = GetBinding(nameof(CheckedValue));

            if (chv != null)
            {
                tag.MergeAttribute(":value", chv.GetPathFormat(context));
            }
            else if (CheckedValue != null)
            {
                tag.MergeAttribute("value", CheckedValue.ToString());
            }
            else
            {
                throw new XamlException("The CheckedValue attribute is required for Radio");
            }
        }
    protected override void OnInit(EventArgs e)
    {
        base.OnInit(e);

        PortalHelper.EnsureScriptManager(Page);

        // Initialize checkbox for special values
        if ((FieldInfo != null) && (FieldInfo.DataType != FormFieldDataTypeEnum.Boolean))
        {
            if (CheckedValue == null)
            {
                CheckedValue = DataHelper.GetNotEmpty(GetValue("CheckedValue"), "");
            }
            if (UncheckedValue == null)
            {
                UncheckedValue = DataHelper.GetNotEmpty(GetValue("UncheckedValue"), "");
            }

            string innerValueString = ValidationHelper.GetString(innerValue, null);
            checkbox.Checked = CMSString.Equals(CheckedValue.ToString(), innerValueString);
        }
    }
    /// <summary>
    /// Compares inner string value with checked value and sets the check box accordingly.
    /// </summary>
    private void HandleStringValue()
    {
        var innerValueString = ValidationHelper.GetString(mInnerValue, null);

        checkbox.Checked = CMSString.Equals(CheckedValue.ToString(), innerValueString);
    }