Ejemplo n.º 1
0
        protected override void Render(HtmlTextWriter writer)
        {
            int intWidth  = string.IsNullOrEmpty(this.Width.ToString()) ? 149 : Convert.ToInt32(this.Width.ToString().Substring(0, this.Width.ToString().Length - 2));
            int intHeight = string.IsNullOrEmpty(this.Height.ToString()) ? 20 : Convert.ToInt32(this.Height.ToString().Substring(0, this.Height.ToString().Length - 2));

            if (string.IsNullOrEmpty(this.Height.ToString()))
            {
                this.Attributes.Add("style", "float:left;border:0px;height:20px");
            }
            else
            {
                this.Attributes.Add("style", "float:left;border:0px;height:" + (intHeight) + "px;");
            }

            writer.AddAttribute(HtmlTextWriterAttribute.Style, "border:solid 1px #AECAF0;background-color:white;width:" + (intWidth + 25) + "px;height:" + intHeight + "px");
            writer.RenderBeginTag(HtmlTextWriterTag.Div);

            writer.AddAttribute(HtmlTextWriterAttribute.Style, "width:" + (intWidth + 24) + "px;");
            writer.RenderBeginTag(HtmlTextWriterTag.Div);


            if (!string.IsNullOrEmpty(this.Check))
            {
                base.Attributes.Add("check", this.Check);
                base.Attributes.Add("cnname", this.CnName);
            }
            base.Render(writer);  //把textbox放在這裡

            writer.AddAttribute(HtmlTextWriterAttribute.Style, "width:20px;float:right;height:" + (intHeight - 4) + "px;border:solid 1px #A3C0E8;margin:1px 0 0 0;background:url(" + ImageUrl + ")  #CBE1FB no-repeat center;");
            if (ButtonClick.ToLower().Contains("javascript:"))
            {
                writer.AddAttribute(HtmlTextWriterAttribute.Onclick, ButtonClick);
            }
            else
            {
                writer.AddAttribute(HtmlTextWriterAttribute.Onclick, "javascript:" + ButtonClick);
            }

            writer.AddAttribute(HtmlTextWriterAttribute.Id, this.ID + "ClickDiv");
            writer.RenderBeginTag(HtmlTextWriterTag.Div);
            writer.RenderEndTag();

            writer.RenderEndTag();
            writer.RenderEndTag();
            // base.Render(writer);
        }