Thumbnail Settings

Thumbnail Settings

Controls featured in this example:

  • Sitecore Web Control

Classes featured in this example:

  • Sitecore.Configuration.Settings
  • Sitecore.Data.Items.Item

Thumbnail Settings C# Web Control Code

Sitecore.Data.Items.Item item = this.GetItem();
if (item == null) return;

output.AddAttribute(System.Web.UI.HtmlTextWriterAttribute.Style, "font-weight:bold; width:100%; clear:both");
output.RenderBeginTag(System.Web.UI.HtmlTextWriterTag.Div);
output.Write("C# Web Control Real-time Output");
output.RenderEndTag();

output.AddAttribute(System.Web.UI.HtmlTextWriterAttribute.Style, "font-size:x-small; width:100%; clear:both");
output.RenderBeginTag(System.Web.UI.HtmlTextWriterTag.Div);
output.AddAttribute(System.Web.UI.HtmlTextWriterAttribute.Style, "font-weight:bold");
output.RenderBeginTag(System.Web.UI.HtmlTextWriterTag.P);
//using : for colon and ? for question mark and   for space
output.Write("{0}: {1}", "Item", item.DisplayName);
output.RenderEndTag(); //P

string thumbnailHeight = Sitecore.Configuration.Settings.ThumbnailHeight.ToString();
string thumbnailsBackgroundColor = Sitecore.Configuration.Settings.ThumbnailsBackgroundColor;
string thumbnailWidth = Sitecore.Configuration.Settings.ThumbnailWidth.ToString();

//using : for colon and   for space
output.Write("{0}&#58;&#160;{1}", "Thumbnails Background Color", "<b>" + thumbnailsBackgroundColor + "</b><br/>");
output.Write("{0}&#58;&#160;{1}", "Thumbnail Height", "<b>" + thumbnailHeight + "</b><br/>"); 
output.Write("{0}&#58;&#160;{1}", "Thumbnail Width", "<b>" + thumbnailWidth + "</b>");
output.RenderEndTag(); //Div


Thumbnail Settings C# Web Control Output

Thumbnails Background Color: #FFFFFF
Thumbnail Height: 50
Thumbnail Width: 0