Adf.Web.Binding.DropDownListPersister.Persist C# (CSharp) Method

Persist() private method

private Persist ( object bindableObject, PropertyInfo pi, object control ) : void
bindableObject object
pi System.Reflection.PropertyInfo
control object
return void
        public virtual void Persist(object bindableObject, PropertyInfo pi, object control)
        {
            var d = control as DropDownList;
            if (d == null) return;

            if (!d.Enabled || !d.Visible) return;

            var value = pi.GetValue(bindableObject, null);
            if (value is IDomainObject)
            {
                var id = IdManager.New(d.SelectedValue);

                // check if a BindScope is used
                var items = BindManager.GetListFor(pi);

                if (items != null)
                {
                    var item = items.Cast<IDomainObject>().FirstOrDefault(o => o.Id == id);

                    if (item != null)
                    {
                        PropertyHelper.SetValue(bindableObject, pi, item);
                        return;
                    }
                }
                PropertyHelper.SetValue(bindableObject, pi, id);
            }
            else
            {
                PropertyHelper.SetValue(bindableObject, pi, d.SelectedValue);
            }
        }
DropDownListPersister