protected override void Render(System.Web.UI.HtmlTextWriter writer) { AddAttributesToRender(writer); writer.AddStyleAttribute("background-color", GetStatusBackColor()); writer.AddStyleAttribute("color", GetStatusForeColor()); writer.RenderBeginTag("span"); writer.Write(status.ToString().ToLower()); writer.RenderEndTag(); }
///<summary> /// Adds font attributes to <see cref="w" /> ///</summary> ///<param name="f">Font should be written to <see cref="w"></param> ///<param name="w">Writer should be used to store properties</param> public static void AddFontAttributes([NotNull] Font f, [NotNull] HtmlWriter w) { w.AddStyleAttribute(HtmlStyleAttribute.FontFamily, f.FontFamily.Name); w.AddStyleAttribute(HtmlStyleAttribute.FontSize, f.Size + (f.Unit == GraphicsUnit.Pixel ? "px" : "pt")); if (f.Bold) { w.AddStyleAttribute(HtmlStyleAttribute.FontWeight, "bold"); } if (f.Italic) { w.AddStyleAttribute(HtmlStyleAttribute.FontStyle, "italic"); } }
public virtual void AddAttributesToRender(System.Web.UI.HtmlTextWriter writer, WebControl owner) { #if NET_2_0 if (RegisteredCssClass.Length > 0) { string cssclass = CssClass; if (!String.IsNullOrEmpty(cssclass)) { writer.AddAttribute(HtmlTextWriterAttribute.Class, cssclass + " " + RegisteredCssClass); } else { writer.AddAttribute(HtmlTextWriterAttribute.Class, RegisteredCssClass); } } else #endif { string cssclass = CssClass; if (cssclass != null && cssclass.Length > 0) { writer.AddAttribute(HtmlTextWriterAttribute.Class, cssclass); } #if NET_2_0 CssStyleCollection col = new CssStyleCollection(); FillStyleAttributes(col, owner); foreach (string key in col.Keys) { writer.AddStyleAttribute(key, col [key]); } #else WriteStyleAttributes(writer); #endif } }
protected override void AddAttributesToRender(System.Web.UI.HtmlTextWriter writer) { // Show the CompareValidator's error message as bold. writer.AddStyleAttribute(System.Web.UI.HtmlTextWriterStyle.FontWeight, "bold"); // Call the Base's AddAttributesToRender method. base.AddAttributesToRender(writer); }
protected override void AddAttributesToRender(System.Web.UI.HtmlTextWriter writer) { // Show the ImageButton with a thin border. writer.AddStyleAttribute("border-width", "thin"); // Call the Base's AddAttributesToRender method. base.AddAttributesToRender(writer); }
protected override void AddAttributesToRender(System.Web.UI.HtmlTextWriter writer) { // Show the HyperLink text as Bold writer.AddStyleAttribute(System.Web.UI.HtmlTextWriterStyle.FontWeight, "bold"); // Call the Base's AddAttributesToRender method. base.AddAttributesToRender(writer); }
protected override void Render(System.Web.UI.HtmlTextWriter writer) { try { writer.AddStyleAttribute(System.Web.UI.HtmlTextWriterStyle.Position, "relative"); writer.RenderBeginTag(System.Web.UI.HtmlTextWriterTag.Div); base.Render(writer); writer.AddStyleAttribute(System.Web.UI.HtmlTextWriterStyle.Position, "absolute"); writer.AddStyleAttribute(System.Web.UI.HtmlTextWriterStyle.Left, (this.Width.Value - 15) + "px"); writer.AddStyleAttribute(System.Web.UI.HtmlTextWriterStyle.Top, "2px"); //writer.AddStyleAttribute(System.Web.UI.HtmlTextWriterStyle.Position, "relative"); //writer.AddStyleAttribute(System.Web.UI.HtmlTextWriterStyle.MarginLeft, "-18px"); //writer.AddStyleAttribute(System.Web.UI.HtmlTextWriterStyle.MarginTop, "0px"); //writer.AddStyleAttribute(System.Web.UI.HtmlTextWriterStyle.Top, "4px"); if (this.Enabled) { writer.AddStyleAttribute(System.Web.UI.HtmlTextWriterStyle.Cursor, "pointer"); writer.AddAttribute(System.Web.UI.HtmlTextWriterAttribute.Src, "../js/DatePicker/skin/datePicker.gif"); if (this._showClear) { writer.AddAttribute("onclick", "WdatePicker({el:'" + this.ClientID + "',dateFmt:'" + this._formatString + "'})"); } else { writer.AddAttribute("onclick", "WdatePicker({el:'" + this.ClientID + "',dateFmt:'" + this._formatString + "',isShowClear:false})"); } } else { writer.AddAttribute(System.Web.UI.HtmlTextWriterAttribute.Src, "../js/DatePicker/skin/datePicker_Disabled.gif"); } writer.RenderBeginTag(System.Web.UI.HtmlTextWriterTag.Img); writer.RenderEndTag(); writer.RenderEndTag(); } catch (Exception ex) { throw (ex); } }
protected override void beforeEndingMainTag(System.Web.UI.HtmlTextWriter html) { html.RenderEndTag(); html.AddAttribute("type", "submit"); html.AddAttribute("id", _nameAndId + "Button"); html.AddAttribute("name", "hiddenSubmitButton"); html.AddStyleAttribute("display", "none"); html.RenderBeginTag("input"); }
public override void WriteHtml(HtmlWriter w) { base.WriteHtml(w); HtmlSerializeHelper<HtmlCodeSnippet>.WriteRootElementAttributes(w, this); w.AddAttribute(HtmlAttribute.Name, "snippet"); w.AddStyleAttribute(HtmlStyleAttribute.Overflow, "auto"); w.RenderBeginTag(HtmlTag.Div); w.Write(((CodeSnippet)Control).HtmlCode); w.RenderEndTag(); }
protected override void AddAttributesToRender(System.Web.UI.HtmlTextWriter writer) { // Add a client-side onclick event to the button. writer.AddAttribute(System.Web.UI.HtmlTextWriterAttribute.Onclick, "alert('Hello World');"); // Update the text of the button to be shown in the color Red writer.AddStyleAttribute(System.Web.UI.HtmlTextWriterStyle.Color, "Red"); // Call the base's AddAttributesToRender method base.AddAttributesToRender(writer); }
public override void WriteHtml(HtmlWriter w) { base.WriteHtml(w); HtmlSerializeHelper <HtmlCodeSnippet> .WriteRootElementAttributes(w, this); w.AddAttribute(HtmlAttribute.Name, "snippet"); w.AddStyleAttribute(HtmlStyleAttribute.Overflow, "auto"); w.RenderBeginTag(HtmlTag.Div); w.Write(((CodeSnippet)Control).HtmlCode); w.RenderEndTag(); }
protected override void Render(System.Web.UI.HtmlTextWriter writer) { try { this.Attributes.Add("MaxDropdownRows", this._maxDropdownRows.ToString()); //Image img = new Image(); //img.ImageUrl = "../images/dropdown.gif"; //this.Controls.Add(img); writer.AddStyleAttribute(System.Web.UI.HtmlTextWriterStyle.Position, "relative"); writer.AddStyleAttribute("z-index", "100"); writer.RenderBeginTag(System.Web.UI.HtmlTextWriterTag.Div); base.Render(writer); writer.AddStyleAttribute(System.Web.UI.HtmlTextWriterStyle.Position, "absolute"); writer.AddStyleAttribute(System.Web.UI.HtmlTextWriterStyle.Left, (this.Width.Value - 15) + "px"); writer.AddStyleAttribute(System.Web.UI.HtmlTextWriterStyle.Top, "3px"); writer.AddStyleAttribute(System.Web.UI.HtmlTextWriterStyle.Width, "15px"); writer.AddStyleAttribute(System.Web.UI.HtmlTextWriterStyle.Height, "15px"); writer.AddStyleAttribute(System.Web.UI.HtmlTextWriterStyle.Cursor, "pointer"); if (this.Items.Count == 0) { //writer.AddStyleAttribute(System.Web.UI.HtmlTextWriterStyle.Display, "none"); } writer.AddAttribute("id", this.ClientID + "_dropdownbutton"); writer.AddAttribute("class", "dropdownbutton"); writer.AddAttribute("onmouseover", "this.className='dropdownbutton2';"); writer.AddAttribute("onmouseout", "this.className='dropdownbutton';"); writer.RenderBeginTag(System.Web.UI.HtmlTextWriterTag.Div); //writer.AddAttribute(System.Web.UI.HtmlTextWriterAttribute.Src, "../images/dropdown2.gif"); //writer.RenderBeginTag(System.Web.UI.HtmlTextWriterTag.Img); //writer.RenderEndTag(); writer.RenderEndTag(); writer.RenderEndTag(); if (!this.Page.ClientScript.IsStartupScriptRegistered(this.ScriptName)) { this.Page.ClientScript.RegisterStartupScript(this.GetType(), this.ScriptName, this.GetJavascript(), false); this.Page.ClientScript.RegisterStartupScript(this.GetType(), Guid.NewGuid().ToString(), this.GetMyJavascript(), false); } } catch (Exception ex) { throw (ex); } }
public override void WriteHtml([NotNull] HtmlWriter w) { base.WriteHtml(w); HtmlSerializeHelper <HtmlHighlightedCode> .WriteRootElementAttributes(w, this); var ls = Language.ToString().ToLower(); w.AddAttribute(HtmlAttribute.Name, "code"); w.AddStyleAttribute(HtmlStyleAttribute.Overflow, "auto"); w.RenderBeginTag(HtmlTag.Span); w.AddAttribute(HtmlAttribute.Class, ls); w.WriteFullBeginTag(string.Concat("pre><code class=\"", ls, "\"")); w.Write(Control.Text.HttpEncode()); w.WriteFullBeginTag("/code></pre"); w.RenderEndTag(); }
///<summary> /// Writes trace log element ///</summary> ///<param name="w">Instance of <see cref="System.Web.UI.HtmlTextWriter"/> to write</param> public static void WriteTraceLogElement([NotNull] HtmlWriter w) { w.AddAttribute(HtmlWriterAttribute.Id, "traceLog"); w.AddAttribute(HtmlWriterAttribute.ReadOnly, "readonly"); w.AddStyleAttribute(HtmlWriterStyle.Width, "100%"); w.AddStyleAttribute(HtmlWriterStyle.Height, "100"); w.AddStyleAttribute(HtmlWriterStyle.Display, "none"); w.AddStyleAttribute("bottom", "0%"); w.AddStyleAttribute(HtmlWriterStyle.Left, "0px"); w.AddStyleAttribute(HtmlWriterStyle.Position, "absolute"); w.RenderBeginTag(HtmlWriterTag.Textarea); w.RenderEndTag(); }
protected override void Render(System.Web.UI.HtmlTextWriter writer) { double sum = 0; for (int i = 0; i < values.Count; i++) { sum += values[i]; } AddAttributesToRender(writer); writer.RenderBeginTag("table"); writer.RenderBeginTag("tr"); for (int i = 0; i < values.Count; i++) { writer.AddStyleAttribute("width", String.Format("{0}%", (int)Math.Round(values[i] / sum * 100))); writer.RenderBeginTag("td"); writer.RenderEndTag(); } writer.RenderEndTag(); writer.RenderEndTag(); }
protected override void Render(System.Web.UI.HtmlTextWriter writer) { writer.AddAttribute("id", this.ClientID); writer.AddAttribute("class", "jtDialogBox"); writer.AddStyleAttribute("z-index", "9999"); writer.AddStyleAttribute("width", this._width + "px"); writer.RenderBeginTag(System.Web.UI.HtmlTextWriterTag.Div); writer.AddAttribute(System.Web.UI.HtmlTextWriterAttribute.Cellpadding, "0"); writer.AddAttribute(System.Web.UI.HtmlTextWriterAttribute.Cellspacing, "0"); writer.AddAttribute(System.Web.UI.HtmlTextWriterAttribute.Border, "0"); writer.AddAttribute(System.Web.UI.HtmlTextWriterAttribute.Width, "100%"); writer.RenderBeginTag(System.Web.UI.HtmlTextWriterTag.Table); writer.RenderBeginTag(System.Web.UI.HtmlTextWriterTag.Tr); writer.RenderBeginTag(System.Web.UI.HtmlTextWriterTag.Td); //******************************************************** //header writer.AddAttribute(System.Web.UI.HtmlTextWriterAttribute.Cellpadding, "0"); writer.AddAttribute(System.Web.UI.HtmlTextWriterAttribute.Cellspacing, "0"); writer.AddAttribute(System.Web.UI.HtmlTextWriterAttribute.Border, "0"); writer.AddAttribute(System.Web.UI.HtmlTextWriterAttribute.Width, "100%"); writer.RenderBeginTag(System.Web.UI.HtmlTextWriterTag.Table); writer.RenderBeginTag(System.Web.UI.HtmlTextWriterTag.Tr); writer.AddAttribute("class", "tbLeft"); writer.RenderBeginTag(System.Web.UI.HtmlTextWriterTag.Td); writer.RenderEndTag(); //td //title --- start writer.AddAttribute("class", "Title"); writer.RenderBeginTag(System.Web.UI.HtmlTextWriterTag.Td); writer.WriteEncodedText(this._title); writer.RenderEndTag(); //td //title --- end //close --- start writer.AddAttribute("class", "tbRight"); writer.RenderBeginTag(System.Web.UI.HtmlTextWriterTag.Td); writer.AddAttribute(System.Web.UI.HtmlTextWriterAttribute.Href, "javascript:void(0)"); //writer.AddAttribute("onclick", "BOX_remove('" + this.ClientID + "');"); this.SetCloseMethod(writer); writer.RenderBeginTag(System.Web.UI.HtmlTextWriterTag.A); writer.AddAttribute(System.Web.UI.HtmlTextWriterAttribute.Src, WebUtils.AppRoot + "images/js_alert/window_close.gif"); writer.RenderBeginTag(System.Web.UI.HtmlTextWriterTag.Img); writer.RenderEndTag(); //img writer.RenderEndTag(); //a writer.RenderEndTag(); //td //close --- end writer.RenderEndTag(); //tr writer.RenderEndTag(); //table //******************************************************** writer.RenderEndTag(); //td writer.RenderEndTag(); //tr writer.RenderBeginTag(System.Web.UI.HtmlTextWriterTag.Tr); writer.AddAttribute("class", "MainPanel"); writer.RenderBeginTag(System.Web.UI.HtmlTextWriterTag.Td); //******************************************************** //content writer.AddAttribute("class", "ContentArea"); writer.AddStyleAttribute("height", this._height + "px"); writer.RenderBeginTag(System.Web.UI.HtmlTextWriterTag.Div); base.Render(writer); writer.RenderEndTag(); //******************************************************** writer.RenderEndTag(); //td writer.RenderEndTag(); //tr writer.RenderEndTag(); //table writer.RenderEndTag(); //div }
///<summary> /// Adds position attributes of <see cref="c"> to <see cref="w" /> ///</summary> ///<param name="c">Control which property should be stored</param> ///<param name="w">Writer should be used to store properties</param> public static void AddPositionAttributes([NotNull] Control c, [NotNull] HtmlWriter w) { w.AddStyleAttribute(HtmlStyleAttribute.Left, c.Left.ToString()); w.AddStyleAttribute(HtmlStyleAttribute.Top, c.Top.ToString()); }
//static HtmlSerializeHelper() //{ // var t = typeof(HtmlSerializeHelper); // addSize = t.GetMethod("AddSizeAttributes", BindingFlags.Static); // addPosition = t.GetMethod("AddPositionAttributes", BindingFlags.Static); // addFont = t.GetMethod("AddFontAttributes", BindingFlags.Static); // readSize = t.GetMethod("ReadSizeAttributes", BindingFlags.Static); // readPosition = t.GetMethod("ReadPositionAttributes", BindingFlags.Static); // readFont = t.GetMethod("ReadFontAttributes", BindingFlags.Static); //} //public static MethodInfo addSize, addPosition, addFont, readSize, readFont, readPosition; ///<summary> /// Adds size attributes of <see cref="c"> to <see cref="w" /> ///</summary> ///<param name="c">Control which property should be stored</param> ///<param name="w">Writer should be used to store properties</param> public static void AddSizeAttributes([NotNull] Control c, [NotNull] HtmlWriter w) { w.AddStyleAttribute(HtmlStyleAttribute.Width, c.Width.ToString()); w.AddStyleAttribute(HtmlStyleAttribute.Height, c.Height.ToString()); }
///<summary> /// Writes Html code to <see cref="System.Web.UI.HtmlTextWriter"/> ///</summary> ///<param name="w"></param> public virtual void WriteHtml([NotNull] HtmlWriter w) { w.AddAttribute(HtmlAttribute.Id, Name); w.AddStyleAttribute(HtmlStyleAttribute.Position, "absolute"); }