Exemple #1
0
        /// <summary>
        /// Sets the value.
        /// </summary>
        /// <param name="control">The control.</param>
        /// <param name="configurationValues">The configuration values.</param>
        /// <param name="value">The value.</param>
        public override void SetEditValue(Control control, Dictionary <string, ConfigurationValue> configurationValues, string value)
        {
            if (value != null)
            {
                var picker = control as DataViewsPicker;
                var guids  = new List <Guid>();

                if (picker != null)
                {
                    guids = value.SplitDelimitedValues().AsGuidList();

                    var dataViews = new DataViewService(new RockContext()).Queryable().Where(a => guids.Contains(a.Guid)).Select(a => a.Id);
                    foreach (System.Web.UI.WebControls.ListItem li in picker.Items)
                    {
                        li.Selected = dataViews.Contains(li.Value.AsInteger());
                    }
                }
            }
        }