public override string Render(int depthLimit, int currentDepth) { var rowDataSb = new StringBuilder(); if (base.Metadata.IsEnumerable && base.Metadata.IsPrimitiveElement) { // check the collection to see if it's all strongly typed, or all primitives so the columns can be built. foreach (var item in (IEnumerable)this.Metadata.SourceObject) { rowDataSb.Append("<tr>"); //TODO: I don't think we need all this code if it's just going to render primitive types. var renderedValue = ValueDisplay.GetDisplayValue(item); var newTag = HtmlTag.WrapValue("td", renderedValue); rowDataSb.Append(newTag); rowDataSb.Append("</tr>"); } } else { throw new InvalidOperationException( "Cannot render rows for a type which does not implement IEnumerable<T>."); } return(rowDataSb.ToString()); }
public override string Render(int depthLimit, int currentDepth) { var source = base.Metadata.SourceObject; var sourceObjectType = base.Metadata.SourceObjectType; var value = ValueDisplay.GetDisplayValue(source, sourceObjectType); return(HtmlTag.WrapValue("span", value).ToString()); }