/// <summary>
        /// Creates the framework control.
        /// </summary>
        /// <param name="context">Contains information associated with the current HTML tag.</param>
        /// <param name="output">A stateful HTML element used to generate an HTML tag.</param>
        /// <returns>The control instance.</returns>
        protected override IFWHtmlElement RenderControl(TagHelperContext context, TagHelperOutput output)
        {
            FWDisplayControl display = new FWDisplayControl(RequestContext, For.Model, For.Metadata)
            {
                DisplayLabel = true
            };

            display.AddCssClass(Class);
            return(display);
        }
Exemplo n.º 2
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 virtual string GetValue(FWRequestContext requestContext, object item, object index)
        {
            var model = Property.GetValue(item);

            if (model != null)
            {
                try
                {
                    var label = new FWDisplayControl(requestContext, model, Metadata);
                    // Clears the sizes of the internal controls.
                    label.Sizes.Clear();
                    label.Attributes.Add("data-type", "fw-cell-text");
                    return(label.ToString());
                }
                catch (FWMissingDatasourceException)
                {
                    return(model.ToString());
                }
            }
            return(string.Empty);
        }