public override IDictionary<string, object> ToDictionary() { Dictionary<string, object> result = new Dictionary<string, object>(); result.AddIfNotExist("rel", "popover"); if (Animation.HasValue) result.AddIfNotExist("data-animation", Animation.Value ? "true" : "false"); if (Html.HasValue) result.AddIfNotExist("data-html", Html.Value ? "true" : "false"); if (!string.IsNullOrEmpty(Placement)) result.AddIfNotExist("data-placement", Placement); if (!string.IsNullOrEmpty(Selector)) result.AddIfNotExist("data-selector", Selector); if (!string.IsNullOrEmpty(Title)) result.AddIfNotExist("data-title", Title); if (!string.IsNullOrEmpty(Content)) result.AddIfNotExist("data-content", Content); if (!string.IsNullOrEmpty(Trigger)) result.AddIfNotExist("data-trigger", Trigger); result.AddIfNotExist("data-placement", "right"); return result; }
public virtual IDictionary<string, object> ToDictionary(HtmlHelper html) { var urlHelper = new UrlHelper(html.ViewContext.RequestContext); var result = new Dictionary<string, object>(); result.AddIfNotExist("data-provide", "typeahead"); result.AddIfNotExist("autocomplete", "off"); if (_result != null) result.AddIfNotExist("data-url", urlHelper.Action(_result)); if (_taskResult != null) result.AddIfNotExist("data-url", urlHelper.Action(_taskResult)); if (!string.IsNullOrEmpty(_actionName) || !string.IsNullOrEmpty(_controllerName)) result.AddIfNotExist("data-url", urlHelper.Action(actionName: _actionName, controllerName: _controllerName)); if (_items.HasValue) result.AddIfNotExist("data-items", _items.Value.ToString()); if (_minLength.HasValue) result.AddIfNotExist("data-minLength", _minLength.Value.ToString()); if (!string.IsNullOrEmpty(_source)) result.AddIfNotExist("data-source", _source); if (!string.IsNullOrEmpty(_matcher)) result.AddIfNotExist("data-matcher", _matcher); if (!string.IsNullOrEmpty(_sorter)) result.AddIfNotExist("data-sorter", _sorter); if (!string.IsNullOrEmpty(_updater)) result.AddIfNotExist("data-updater", _updater); if (!string.IsNullOrEmpty(_highlighter)) result.AddIfNotExist("data-highlighter", _highlighter); return result; }