Esempio n. 1
0
 protected override void OnPreRender(EventArgs e)
 {
     if (body != null && !String.IsNullOrEmpty(TabSectionId))
     {
         ControlHelper.AddCssClass(body, TabSectionId);
     }
 }
Esempio n. 2
0
        static void SetButtonStyle(Control control)
        {
            var button = control as Button;

            if (button != null)
            {
                ControlHelper.AddCssClass(button, "button");
            }
        }
Esempio n. 3
0
        static void SetTextBoxStyle(Control control)
        {
            var textBox = control as TextBox;

            if (textBox != null)
            {
                if (textBox.TextMode == TextBoxMode.SingleLine || textBox.TextMode == TextBoxMode.Password)
                {
                    ControlHelper.AddCssClass(textBox, "textbox");
                }
                if (textBox.TextMode == TextBoxMode.MultiLine)
                {
                    ControlHelper.AddCssClass(textBox, "textarea");
                }
            }
        }
Esempio n. 4
0
        public void OnlyAddCssClassWhenNotAlreadyThere()
        {
            var label = new Label();

            label.CssClass = "foo bar baz quux";

            ControlHelper.AddCssClass(label, "baz");
            Assert.AreEqual("foo bar baz quux", label.CssClass);

            ControlHelper.AddCssClass(label, "click");
            Assert.AreEqual("foo bar baz quux click", label.CssClass);

            label.CssClass = "click";
            ControlHelper.AddCssClass(label, "click");
            Assert.AreEqual("click", label.CssClass);

            label.CssClass = "";
            ControlHelper.AddCssClass(label, "click");
            Assert.AreEqual("click", label.CssClass);

            label.CssClass = "click";
            ControlHelper.AddCssClass(label, "cluck");
            Assert.AreEqual("click cluck", label.CssClass);
        }