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

BindToList() private method

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

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

            foreach (string key in controlBinders.Keys)
            {
                // First, check if the control itself needs to be bound
                if (c.ID.StartsWith(key))
                {
                    foreach (IControlBinder binder in controlBinders[key])
                    {
                        binder.Bind(c, bindableObjects, p);
                    }
                }

                if (bindableObjects != null)
                {
                    // Next, check if there are children that need to be bound
                    string name = key + bindableObjects.GetType().Name.Replace("[]", "");

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

                    foreach (IControlBinder binder in _binders[key])
                    {
                        binder.Bind(dictionary[name], bindableObjects);
                    }
                }
            }
        }