예제 #1
0
        /// <summary>
        /// Gets the column text value.
        /// </summary>
        /// <param name="requestContext">The request helper.</param>
        /// <param name="item">The column object item.</param>
        /// <param name="index">The line index.</param>
        /// <returns>The column text value.</returns>
        public override string GetValue(FWRequestContext requestContext, object item, object index)
        {
            HtmlContentBuilder builder = new HtmlContentBuilder();

            foreach (var template in _templates)
            {
                // Formats the template the the object values.
                Dictionary <string, string> dictionary = item.GetType().GetProperties()
                                                         .ToDictionary(x => x.Name, x => x.GetValue(item)?.ToString() ?? "");
                dictionary.Add("FWTemplateIndex", index.ToString());
                var html = Smart.Format(template, dictionary);
                builder.AppendHtml(html);
            }
            return(builder.GetContent());
        }