Ejemplo n.º 1
0
        /// <summary>
        /// Prevents a default instance of the <see cref="RelatedEntityList" /> class from being created.
        /// </summary>
        private void ShowContent()
        {
            lTitle.Text = HeaderTitle;
            lIcon.Text  = $"<i class=\"{ HeaderIconCssClass}\"></i> ";

            // Render content
            var mergeFields = Rock.Lava.LavaHelper.GetCommonMergeFields(this.RockPage, this.CurrentPerson);

            // Get existing relationships
            var existingRelationships = GetExistingRelationships();

            mergeFields.Add("ExistingRelationships", existingRelationships);

            lContent.Text = LavaTemplate.ResolveMergeFields(mergeFields, GetAttributeValue(AttributeKey.EnabledLavaCommands));
        }
Ejemplo n.º 2
0
        /// <summary>
        /// Formats the specified field value for a cell in the <see cref="T:System.Web.UI.WebControls.BoundField" /> object.
        /// </summary>
        /// <param name="dataValue">The field value to format.</param>
        /// <param name="encode">true to encode the value; otherwise, false.</param>
        /// <returns>
        /// The field value converted to the format specified by <see cref="P:System.Web.UI.WebControls.BoundField.DataFormatString" />.
        /// </returns>
        protected override string FormatDataValue(object dataValue, bool encode)
        {
            IDictionary <string, object> mergeFields;

            if (LavaMergeFields != null)
            {
                mergeFields = new Dictionary <string, object>(LavaMergeFields);
            }
            else
            {
                mergeFields = new Dictionary <string, object>();
            }

            /* Certain empty values come through as DBNull objects which are not Lava friendly. */
            if (dataValue != null && dataValue.GetType() == typeof(DBNull))
            {
                dataValue = null;
            }

            mergeFields.Add(LavaKey ?? "Item", dataValue);
            dataValue = LavaTemplate.ResolveMergeFields(mergeFields);

            return(base.FormatDataValue(dataValue, encode));
        }