Abl.Mvc.HtmlHelpers.HtmlHelperExtensions.SortExpressionLink C# (CSharp) Метод

SortExpressionLink() публичный статический Метод

public static SortExpressionLink ( this helper, string title, string sortExpression, SortDirection direction = SortDirection.Ascending, object htmlAttributes = null ) : System.Web.Mvc.MvcHtmlString
helper this
title string
sortExpression string
direction SortDirection
htmlAttributes object
Результат System.Web.Mvc.MvcHtmlString
        public static MvcHtmlString SortExpressionLink(
            this HtmlHelper helper,
            string title,
            string sortExpression,
            SortDirection direction = SortDirection.Ascending,
            object htmlAttributes = null)
        {
            var a = new TagBuilder("a");

            if (htmlAttributes != null)
            {
                // get the attributes
                IDictionary<string, object> attributes =
                    HtmlHelper.AnonymousObjectToHtmlAttributes(htmlAttributes)
                        as IDictionary<string, object>;

                // set the attributes
                a.MergeAttributes(attributes);
            }

            var i = new TagBuilder("i");
            i.MergeAttribute("class", "indicator");

            a.AddCssClass("sort-expression-link");

            a.MergeAttribute("title", title);
            a.MergeAttribute("href", "#" + sortExpression);
            a.MergeAttribute("data-sort-expression", sortExpression);
            a.MergeAttribute("data-sort-direction", direction.ToString());
            a.InnerHtml = title + i.ToString(TagRenderMode.Normal);

            return
                MvcHtmlString.Create(a.ToString(TagRenderMode.Normal));
        }