internal static void RegisterImagePaths(string[] imageNames, Control control) { if (imageNames.Length < 1) { return; } control.Page.ClientScript.RegisterStartupScript( control.Page.GetType(), "bb9d9f1593ff41a198714a472d603c55", "Type.registerNamespace('Sys.Extended.UI.Images');", true ); var jser = new JavaScriptSerializer(); var builder = new StringBuilder(); foreach (var name in imageNames) { builder.AppendLine("Sys.Extended.UI.Images[" + jser.Serialize(name) + "] = " + jser.Serialize(ToolkitResourceManager.GetImageHref(name, control)) + ";"); } control.Page.ClientScript.RegisterStartupScript(control.GetType(), "086a0778a11d433386793f72ea881602", builder.ToString(), true); }
void ITemplate.InstantiateIn(Control container) { // Add header var ctlHeader = new HtmlGenericControl("div"); ctlHeader.Attributes.Add("class", "ajax__twitter_header"); container.Controls.Add(ctlHeader); // Create Profile Image Url var ctlProfileImage = new Image() { ImageUrl = _twitter.ProfileImageUrl }; ctlHeader.Controls.Add(ctlProfileImage); // Create Title var ctlTitle = new HtmlGenericControl("h3"); ctlTitle.Controls.Add(new LiteralControl(_twitter.Title)); ctlHeader.Controls.Add(ctlTitle); // Create Caption var ctlCaption = new HtmlGenericControl("h4"); ctlCaption.Controls.Add(new LiteralControl(_twitter.Caption)); ctlHeader.Controls.Add(ctlCaption); // Add unordered list var ctlList = new HtmlGenericControl("ul"); ctlList.Attributes.Add("class", "ajax__twitter_itemlist"); ctlList.Style.Add("margin", "0px"); container.Controls.Add(ctlList); // Create item placeholder var plhItem = new PlaceHolder(); plhItem.ID = "ItemPlaceholder"; ctlList.Controls.Add(plhItem); var ctlFooter = new HtmlGenericControl("div"); var smallLogoUrl = ToolkitResourceManager.GetImageHref(Constants.Twitter24Image, _twitter); ctlFooter.Attributes.Add("class", "ajax__twitter_footer"); ctlFooter.Controls.Add(new Image() { ImageUrl = smallLogoUrl }); container.Controls.Add(ctlFooter); }
protected string GenerateHtmlInputFileControl(string lastFileName) { var div = new HtmlGenericControl("div"); Controls.Add(div); if (this.UploaderStyle == AsyncFileUploaderStyle.Modern) { var bgImageUrl = ToolkitResourceManager.GetImageHref(AjaxControlToolkit.Constants.AsyncFileUploadImage, this); var style = "background:url(" + bgImageUrl + ") no-repeat 100% 1px; height:24px; margin:0px; text-align:right;"; if (!Width.IsEmpty) { style += "min-width:" + Width.ToString() + ";width:" + Width.ToString() + " !important;"; } else { style += "width:355px;"; } div.Attributes.Add("style", style); } if (!(this.UploaderStyle == AsyncFileUploaderStyle.Modern && IsDesignMode)) { _inputFile = new HtmlInputFile(); if (!this.Enabled) { _inputFile.Disabled = true; } div.Controls.Add(_inputFile); _inputFile.Attributes.Add("id", _inputFile.Name.Replace("$", "_")); if (this.UploaderStyle != AsyncFileUploaderStyle.Modern) { if (BackColor != Color.Empty) { _inputFile.Style[HtmlTextWriterStyle.BackgroundColor] = ColorTranslator.ToHtml(BackColor); } if (!Width.IsEmpty) { _inputFile.Style[HtmlTextWriterStyle.Width] = Width.ToString(); } else { _inputFile.Style[HtmlTextWriterStyle.Width] = "355px"; } } } if (this.UploaderStyle == AsyncFileUploaderStyle.Modern) { var style = "opacity:0.0; -moz-opacity: 0.0; filter: alpha(opacity=00); font-size:14px;"; if (!Width.IsEmpty) { style += "width:" + Width.ToString() + ";"; } if (_inputFile != null) { _inputFile.Attributes.Add("style", style); } var textBox = new TextBox(); if (!IsDesignMode) { var div1 = new HtmlGenericControl("div"); div.Controls.Add(div1); style = "margin-top:-23px;text-align:left;"; div1.Attributes.Add("style", style); div1.Attributes.Add("type", "text"); div1.Controls.Add(textBox); style = "height:17px; font-size:12px; font-family:Tahoma;"; } else { div.Controls.Add(textBox); style = "height:23px; font-size:12px; font-family:Tahoma;"; } if (!Width.IsEmpty && Width.ToString().IndexOf("px") > 0) { style += "width:" + (int.Parse(Width.ToString().Substring(0, Width.ToString().IndexOf("px"))) - 107).ToString() + "px;"; } else { style += "width:248px;"; } if (lastFileName != String.Empty || this._failedValidation) { if ((this.FileBytes != null && this.FileBytes.Length > 0) && (!this._failedValidation)) { style += "background-color:#00FF00;"; } else { this._failedValidation = false; style += "background-color:#FF0000;"; } textBox.Text = lastFileName; } else if (BackColor != Color.Empty) { style += "background-color:" + ColorTranslator.ToHtml(BackColor) + ";"; } textBox.ReadOnly = true; textBox.Attributes.Add("style", style); this._innerTBID = textBox.ClientID; } else if (IsDesignMode) { Controls.Clear(); Controls.Add(_inputFile); } return(div.ClientID); }