private static IHtmlString EntityEditingMetadata(IPortalViewEntity entity, IPortalViewContext portalViewContext, string cssClass = null) { if (entity == null) { return(new HtmlString(string.Empty)); } if (!entity.Editable) { return(new HtmlString(string.Empty)); } if (portalViewContext == null) { throw new ArgumentNullException("portalViewContext"); } var tag = new TagBuilder("div"); tag.Attributes["style"] = "display:none;"; tag.AddCssClass("xrm-entity"); tag.AddCssClass("xrm-editable-{0}".FormatWith(entity.EntityReference.LogicalName)); if (portalViewContext.IsCurrentSiteMapNode(entity)) { tag.AddCssClass("xrm-entity-current"); } if (!String.IsNullOrEmpty(cssClass)) { tag.AddCssClass(cssClass); } portalViewContext.RenderEditingMetadata(entity, tag); return(new HtmlString(tag.ToString())); }