/// <summary> /// Allow the Details control to decorate the parent container. /// </summary> /// <returns>Returns a set of control bases to decorate with.</returns> public override IEnumerable<HtmlControlBase> DecorateContainer() { string type = Inspector.Result.Exception.GetType().ToString(); if (type.Contains(Utf)) { type = type.Remove(0, Utf.Length); } if (type.StartsWith("System.", StringComparison.OrdinalIgnoreCase)) { type = type.Substring(7); } string message = Inspector.Result.Exception.Message; HtmlSpan ce = new HtmlSpan(); ce.InnerHtml = type; ce.SetStyleAttribute(CssAttribute.Display, CssDisplay.InlineBlock); ce.Margin.All = 2; ce.Padding.All = 4; ce.BackgroundColor = Color.Tan; yield return ce; HtmlSpan oc = new HtmlSpan(); oc.InnerText = " occurred"; yield return oc; HtmlDiv cm = new HtmlDiv(); cm.Margin.All = 4; cm.Padding.All = 1; cm.InnerHtml = message; yield return cm; }
/// <summary> /// Creates a boxed container. /// </summary> /// <param name="header">The header for the container.</param> /// <returns>Returns the new container.</returns> protected static HtmlControl CreateContainer(string header) { HtmlControl control = CreateContainer(); HtmlSpan txt = new HtmlSpan(); txt.InnerText = header; txt.SetStyleAttribute(CssAttribute.Display, CssDisplay.Block); control.Controls.Add(txt); return control; }