Пример #1
0
        protected override void Render(HtmlTextWriter writer)
        {
            writer.AddAttribute(HtmlTextWriterAttribute.Style, "margin: 0 0 0 0;");

            if (CssClass.IsNotEmpty())
            {
                writer.AddAttribute(HtmlTextWriterAttribute.Class, CssClass);
            }

            writer.RenderBeginTag("div");



            RenderRightBlock(writer);

            writer.AddAttribute(HtmlTextWriterAttribute.Class, Type == RoundedButtonType.Orange ? "orbtnctd" : Type == RoundedButtonType.GrayBig ? "rbtnctd_big" : "rbtnctd");

            writer.RenderBeginTag("div");

            writer.AddAttribute(HtmlTextWriterAttribute.Class,
                                Type == RoundedButtonType.Orange ? "orbtninput" : Type == RoundedButtonType.GrayBig ? "rbtninput_big" : "rbtninput");

            base.Render(writer);

            writer.RenderEndTag();

            RenderLeftBlock(writer);

            writer.RenderEndTag();
        }
Пример #2
0
        protected override void Render(HtmlTextWriter writer)
        {
            if (DefaultButtonID.IsNotEmpty())
            {
                writer.AddAttribute("onkeyup", string.Format("defaultButtonClick('{0}', event)", DefaultButtonID));
            }

            writer.AddAttribute(HtmlTextWriterAttribute.Class, string.Format("{0}{1}{2}",
                                                                             CssClass.IsNotEmpty() ? CssClass : string.Empty,
                                                                             ValidationType != eValidationType.None ? " valid-" + ValidationType.ToString().ToLower() : string.Empty,
                                                                             ValidationGroup.IsNotEmpty() ? " group-" + ValidationGroup : string.Empty));
            base.Render(writer);
        }
Пример #3
0
        protected override void Render(HtmlTextWriter writer)
        {
            writer.AddAttribute(HtmlTextWriterAttribute.Class, "btn-c" + (CssSpan.IsNotEmpty() ? " " + CssSpan : ""));
            writer.RenderBeginTag(HtmlTextWriterTag.Span);

            if (Href.IsNotEmpty() && Click != null)
            {
                throw new Exception("Href and Server Event can't be used together");
            }

            if (Click != null)
            {
                //Uncomment if POSTBACK is not rising
                //writer.AddAttribute(HtmlTextWriterAttribute.Name, ClientID);
                if (DisableValidation)
                {
                    writer.AddAttribute(HtmlTextWriterAttribute.Href, "javascript:" + Page.ClientScript.GetPostBackEventReference(this, ClientID));
                }
                else
                {
                    //Uncomment if POSTBACK is not rising
                    //writer.AddAttribute(HtmlTextWriterAttribute.Href, "javascript:" + string.Format("__doPostBackJQ('{0}','{1}')", UniqueID, ClientID));
                    writer.AddAttribute(HtmlTextWriterAttribute.Href, "javascript:" + string.Format("__doPostBackJQ('{0}','')", UniqueID));
                }

                writer.AddAttribute(HtmlTextWriterAttribute.Name, UniqueID);
            }
            else
            {
                writer.AddAttribute(HtmlTextWriterAttribute.Href, Href.IsNotEmpty() ? Href : "javascript:void(0);");
            }

            if (OnClientClick.IsNotEmpty())
            {
                writer.AddAttribute(HtmlTextWriterAttribute.Onclick, OnClientClick);
            }

            if (Rel.IsNotEmpty())
            {
                writer.AddAttribute(HtmlTextWriterAttribute.Rel, Rel);
            }

            if (Target.IsNotEmpty())
            {
                writer.AddAttribute(HtmlTextWriterAttribute.Target, Target);
            }

            if (CssStyle.IsNotEmpty())
            {
                writer.AddAttribute(HtmlTextWriterAttribute.Style, CssStyle);
            }

            writer.AddAttribute(HtmlTextWriterAttribute.Class, string.Format("btn{0}{1}{2}{3}",
                                                                             Type != eType.None ? " btn-" + Type.ToString().ToLower() : string.Empty,
                                                                             Size != eSize.None ? " btn-" + Size.ToString().ToLower() : string.Empty,
                                                                             CssClass.IsNotEmpty() ? " " + CssClass : string.Empty,
                                                                             ValidationGroup.IsNotEmpty() ? " group-" + ValidationGroup : string.Empty));
            if (ID.IsNotEmpty())
            {
                writer.AddAttribute(HtmlTextWriterAttribute.Id, ID);
            }

            IEnumerator keys = this.Attributes.Keys.GetEnumerator();

            while (keys.MoveNext())
            {
                var key = (String)keys.Current;
                writer.AddAttribute(key, this.Attributes[key]);
            }

            writer.RenderBeginTag(HtmlTextWriterTag.A);
            writer.Write(Text);
            writer.RenderEndTag(); // a

            writer.RenderEndTag(); // span
        }
Пример #4
0
        protected override void Render(HtmlTextWriter writer)
        {
            if (IsWrap)
            {
                var cssClassWrapDefault = TextMode == eTextMode.Multiline ? "textarea-wrap" : "input-wrap";
                writer.AddAttribute(HtmlTextWriterAttribute.Class, cssClassWrapDefault + (CssClassWrap.IsNotEmpty() ? " " + CssClassWrap : ""));
                writer.RenderBeginTag(HtmlTextWriterTag.Div);
            }

            if (Placeholder.IsNotEmpty())
            {
                writer.AddAttribute("placeholder", Placeholder);
            }

            if (DefaultButtonID.IsNotEmpty())
            {
                writer.AddAttribute("onkeyup", string.Format("defaultButtonClick('{0}', event)", DefaultButtonID));
            }

            if (ReadOnly)
            {
                writer.AddAttribute(HtmlTextWriterAttribute.ReadOnly, "readonly");
            }

            if (Disabled)
            {
                writer.AddAttribute(HtmlTextWriterAttribute.Disabled, "disabled");
            }

            if (MaxLength != 0)
            {
                writer.AddAttribute(HtmlTextWriterAttribute.Maxlength, MaxLength.ToString());
            }


            writer.AddAttribute(HtmlTextWriterAttribute.Id, ID);
            writer.AddAttribute(HtmlTextWriterAttribute.Name, UniqueID);

            writer.AddAttribute(HtmlTextWriterAttribute.Class, string.Format("{0}{1}{2}",
                                                                             CssClass.IsNotEmpty() ? CssClass : string.Empty,
                                                                             ValidationType != eValidationType.None ? " valid-" + ValidationType.ToString().ToLower() : string.Empty,
                                                                             ValidationGroup.IsNotEmpty() ? " group-" + ValidationGroup : string.Empty));
            if (TextMode == eTextMode.Text || TextMode == eTextMode.Password)
            {
                writer.AddAttribute(HtmlTextWriterAttribute.Type, TextMode.ToString().ToLower());
            }

            if (TextMode == eTextMode.Multiline)
            {
                writer.RenderBeginTag(HtmlTextWriterTag.Textarea);
                writer.Write(Text);
            }
            else
            {
                writer.AddAttribute(HtmlTextWriterAttribute.Value, Text ?? string.Empty);
                writer.RenderBeginTag(HtmlTextWriterTag.Input);
            }
            writer.RenderEndTag();


            if (IsWrap)
            {
                writer.RenderEndTag();
            }
        }