Exemple #1
0
        public static ColumnViewModel <T> IsLink <T>(this ColumnViewModel <T> col)
        {
            col.HtmlDisplayValue = (vc, html, x) => new HtmlString(
                string.Format("<a href=\"{0}\">{1}</a>",
                              col.GetValue(x), HttpUtility.HtmlEncode(col.GetValue(x))));

            return(col);
        }
Exemple #2
0
        public static ColumnViewModel <T> WithLinkInNewWindow <T>(this ColumnViewModel <T> col, Func <T, string> link, string cssclasses, Func <T, string> refFunc)
        {
            col.HtmlDisplayValue = (vc, html, x) => new HtmlString(
                string.Format("<a href=\"{0}\" class=\"{2}\" ref=\"{3}\" target=\"_blank\">{1}</a>",
                              link(x), HttpUtility.HtmlEncode(col.GetValue(x)), cssclasses, refFunc(x)));

            return(col);
        }
Exemple #3
0
        public static ColumnViewModel <T> WithLink <T>(this ColumnViewModel <T> col, Func <T, string> link)
        {
            col.HtmlDisplayValue = (vc, html, x) => new HtmlString(
                string.IsNullOrWhiteSpace(link(x)) ? HttpUtility.HtmlEncode(col.GetValue(x)) :
                string.Format("<a href=\"{0}\">{1}</a>", link(x), HttpUtility.HtmlEncode(col.GetValue(x))));

            return(col);
        }
Exemple #4
0
 public static ColumnViewModel <T> AsReversedYesNo <T>(this ColumnViewModel <T> col)
 {
     col.WithDisplayValue(x => (col.GetValue(x.Data) ?? string.Empty)
                          .Equals(false.ToString(), StringComparison.InvariantCultureIgnoreCase) ? "Yes" : "No");
     return(col);
 }
Exemple #5
0
 public static ColumnViewModel <T> Shorten <T>(this ColumnViewModel <T> col, int max, string maxString)
 {
     col.WithDisplayValue(x => col.GetValue(x.Data).Length > max ? col.GetValue(x.Data).Substring(0, max) + maxString : col.GetValue(x.Data));
     return(col);
 }
Exemple #6
0
 public static ColumnViewModel <T> ShortenWithFullTooltip <T>(this ColumnViewModel <T> col, int max)
 {
     col.Shorten(max, "...");
     col.WithTooltip((o) => col.GetValue(o));
     return(col);
 }