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

BindToArray() private static method

Binds the specified array 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 static BindToArray ( Control c, object bindableObjects, Dictionary controlBinders ) : void
c System.Web.UI.Control The or the child /// of which is to bind to.
bindableObjects object The array of business objects to bind.
controlBinders Dictionary The list of control binders used to bind.
return void
        private static void BindToArray(Control c, object[] bindableObjects, Dictionary<string, List<IControlBinder>> controlBinders)
        {
            if (c == null || bindableObjects == null || bindableObjects.Length < 1)
                return;

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

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

                Control controlToBind = ControlHelper.Find(c, name);
                if (controlToBind != null)
                {
                    foreach (IControlBinder controlBinder in controlBinders[key])
                    {
                        controlBinder.Bind(controlToBind, bindableObjects);
                    }
                }
            }
        }