public MvcHtmlString ToHtml(HtmlHelper helper) { HtmlStringBuilder sb = new HtmlStringBuilder(); using (sb.SurroundLine("li")) { sb.Add(helper.ScriptCss("~/Help/Content/helpWidget.css")); var id = TypeContextUtilities.Compose(Prefix, "helpButton"); sb.Add(new HtmlTag("button").Id(id) .Class("btn btn-xs btn-help btn-help-widget") .Class(HelpLogic.GetEntityHelp(RootType).HasEntity ? "hasItems" : null) .Attr("type", "button") .SetInnerText("?")); var type = HelpLogic.GetEntityHelpService(this.RootType); var jsType = new { Type = TypeLogic.GetCleanName(type.Type), Info = type.Info, Operations = type.Operations.ToDictionary(a => a.Key.Key, a => a.Value), Properties = type.Properties.ToDictionary(a => a.Key.ToString(), a => a.Value), }; sb.Add(MvcHtmlString.Create("<script>$('#" + id + "').on('mouseup', function(event){ if(event.which == 3) return; " + HelpClient.WidgetModule["entityClick"](JsFunction.This, this.Prefix, jsType, helper.UrlHelper().Action((HelpController c) => c.PropertyRoutes())).ToString() + " })</script>")); } return(sb.ToHtml()); }