JsonFx.UI.Jbst.JbstWriter.SetStyle C# (CSharp) Method

SetStyle() private method

private SetStyle ( JbstContainerControl target, string name, string value ) : void
target JbstContainerControl
name string
value string
return void
        private void SetStyle(JbstContainerControl target, string name, string value)
        {
            if (String.IsNullOrEmpty(name) && String.IsNullOrEmpty(value))
            {
                return;
            }

            if (target == null)
            {
                throw new NullReferenceException("target is null");
            }

            string style =
                target.Attributes.ContainsKey("style") ?
                target.Attributes["style"] as String :
                null;

            if (style != null && !style.EndsWith(";"))
            {
                style += ";";
            }

            if (String.IsNullOrEmpty(name))
            {
                style += value;
            }
            else
            {
                style += name+':'+value;
            }

            target.Attributes["style"] = style;
        }