Beispiel #1
0
        private string GetTextValue(object value)
        {
            if (value == null)
            {
                return(null);
            }
            string text = !DisplayMember.IsNullOrEmpty()
                    ? value.GetType().GetProperty(DisplayMember)?.GetValue(value) as string ?? value.ToString()
                    : value.ToString();

            return(HtmlDecode ? text.HtmlDecode() : text);
        }
Beispiel #2
0
 protected override void OnFormat(ListControlConvertEventArgs e)
 {
     base.OnFormat(e);
     if (HtmlDecode)
     {
         if (!DisplayMember.IsNullOrEmpty())
         {
             var property = e.ListItem.GetType().GetProperty(DisplayMember);
             if (property != null)
             {
                 e.Value = WebUtility.HtmlDecode(property.GetValue(e.ListItem) as string);
             }
         }
     }
 }