Displaying Thumbnails

Displaying Thumbnails

Displaying Thumbnails

The FieldRenderer control generates inline editing controls for the Page Editor and will render appropriate html code for some data types instead of just raw values. The following fieldtypes can be displayed by the fieldrenderer - Single-Line Text, Multi-Line Text, Integer, Number, Image, Date, Datetime, General Link and Rich Text

  1. Create an instance of ChildList class - represents a list of subitems of an item
  2. Write the opening tag of the specified DIV markup element to the output stream
  3. Iterate over child items
  4. Display image field


C# Web Control Code

Sitecore.Collections.ChildList children = Sitecore.Context.Item.GetChildren(ChildListOptions.None);

 

output.AddAttribute(HtmlTextWriterAttribute.Class, "cssclass1");

output.RenderBeginTag(HtmlTextWriterTag.Div);


foreach (Item child in children)

{

      output.AddAttribute(HtmlTextWriterAttribute.Class, "cssclass2");

      output.RenderBeginTag(HtmlTextWriterTag.Div);

      output.Write(FieldRenderer.Render(child, "fieldname");

      output.RenderEndTag();

}

output.RenderEndTag();