Adf.Web.Binding.WebBinder.BindToObject C# (CSharp) Method

BindToObject() private static method

Binds the specified business object to the specified System.Web.UI.Control or its child System.Web.UI.Control using the specified list of control binders.
private static BindToObject ( Control c, object bindableObject, Dictionary controlBinders, object p ) : void
c System.Web.UI.Control The or the child /// of which is to bind to.
bindableObject object The business object to bind.
controlBinders Dictionary The list of control binders used to bind.
p object
return void
        private static void BindToObject(Control c, object bindableObject, Dictionary<string, List<IControlBinder>> controlBinders, object[] p)
        {
            if (c == null || bindableObject == null)
                return;

            string domainobject = bindableObject.GetType().Name;
            PropertyInfo[] properties = bindableObject.GetType().GetProperties(BindingFlags.Instance | BindingFlags.Public);

            Dictionary<string, Control> dictionary = c.GetControls();

            foreach (PropertyInfo pi in properties)
            {
                foreach (string key in controlBinders.Keys)
                {
                    string name = key + domainobject + pi.Name;

                    if (!dictionary.ContainsKey(name)) continue;

                    foreach (IControlBinder binder in controlBinders[key])
                    {
                        binder.Bind(dictionary[name], GetValue(bindableObject, pi), pi, p);
                    }
                }
            }
        }