コード例 #1
0
        private static MvcHtmlString Th <TModel>(this HtmlHelper <TModel> htmlHelper, PropertyDescriptor property, IPageOfList pagedList, object htmlAttributes = null,
                                                 bool defaultSort = false)
        {
            var th = new ThModel
            {
                Text = property.ShortName,
            };

            if (pagedList != null && !string.IsNullOrEmpty(property.Sort))
            {
                if (pagedList.OrderBy == property.Sort)
                {
                    th.Sort      = property.Sort + " desc";
                    th.Directory = false;
                }
                else if (pagedList.OrderBy.StartsWith(property.Sort))
                {
                    th.Sort      = property.Sort;
                    th.Directory = true;
                }
                else
                {
                    th.Sort = property.Sort;
                }
            }
            return(htmlHelper.Partial(GetTemplateName("th"), th, ToViewData(htmlAttributes)));
        }
コード例 #2
0
        public static MvcHtmlString Th <TModel>(this HtmlHelper <TModel> htmlHelper, Ths ths, object htmlAttributes = null)
        {
            if (ths == Mvc.Ths.Select)
            {
                return(htmlHelper.Partial(GetTemplateName("th_select"), null));
            }
            ThModel th = GetThModel(ths);
            var     vd = new ViewDataDictionary();

            vd.Merge(HtmlHelper.AnonymousObjectToHtmlAttributes(htmlAttributes));
            return(htmlHelper.Partial(GetTemplateName("th"), th, ToViewData(htmlAttributes)));
        }
コード例 #3
0
 public static MvcHtmlString Th(this HtmlHelper htmlHelper, ThModel th)
 {
     return(htmlHelper.Partial(GetTemplateName("th"), th, new ViewDataDictionary()));
 }