示例#1
0
        private IAutoBindeable GetParent <T>()
        {
            if (string.IsNullOrEmpty(ParentControls))
            {
                return(null);
            }
            foreach (var parent in ParentControls.Split(','))
            {
                var control = FindParent(parent.Trim(), Page.Controls);
                if (control == null)
                {
                    continue;
                }
                var iab = control as IAutoBindeable;
                if (iab != null && iab.Type == typeof(T))
                {
                    return(iab);
                }

                var ipc = control as IParentControl;
                if (ipc != null)
                {
                    foreach (var bindeable in ipc.ParentControls.Where(bindeable => bindeable.Type == typeof(T)))
                    {
                        return(bindeable);
                    }
                }
            }
            return(null);
        }
示例#2
0
        private void LoadParents()
        {
            if (string.IsNullOrEmpty(ParentControls))
            {
                return;
            }

            foreach (var parent in ParentControls.Split(','))
            {
                var control = FindParent(parent.Trim(), Page.Controls);
                if (control == null)
                {
                    continue;
                }
                var iab = control as IAutoBindeable;
                var ipc = control as IParentControl;
                if (iab != null)
                {
                    if (iab.Type == typeof(Empresa))
                    {
                        IdEmpresa = iab.Selected;
                    }
                    else if (iab.Type == typeof(Linea))
                    {
                        IdLinea = iab.Selected;
                    }
                }
                else if (ipc != null)
                {
                    foreach (var bindeable in ipc.ParentControls)
                    {
                        if (bindeable.Type == typeof(Empresa))
                        {
                            IdEmpresa = bindeable.Selected;
                        }
                        else if (bindeable.Type == typeof(Linea))
                        {
                            IdLinea = bindeable.Selected;
                        }
                    }
                }
            }
        }
示例#3
0
 private void LoadParents()
 {
     if (!string.IsNullOrEmpty(ParentControls))
     {
         foreach (var parent in ParentControls.Split(','))
         {
             var control = FindParent(parent.Trim(), Page.Controls);
             if (control == null)
             {
                 continue;
             }
             var autobind = control as IAutoBindeable3;
             if (autobind != null)
             {
                 AddParent(autobind);
             }
         }
     }
 }
示例#4
0
        /// <summary>
        /// Loads control parents.
        /// </summary>
        private void LoadParents()
        {
            if (!string.IsNullOrEmpty(ParentControls))
            {
                foreach (var parent in ParentControls.Split(','))
                {
                    var control = FindParent(parent.Trim(), Page.Controls);

                    if (control == null)
                    {
                        continue;
                    }

                    var autobind = control as IAutoBindeable;
                    var owner    = control as IParentControl;

                    if (autobind != null)
                    {
                        AddParent(autobind);
                    }
                    else if (owner != null)
                    {
                        foreach (var ctl in owner.ParentControls)
                        {
                            AddParent(ctl);
                        }
                    }
                }
            }
            if (!string.IsNullOrEmpty(FilterControl))
            {
                _filter = FindParent(FilterControl, Page.Controls) as TextBox;
                if (_filter != null)
                {
                    _filter.TextChanged += DdlSelectedIndexChanged;
                    _filter.AutoPostBack = true;
                }
            }
            _parentsLoaded = true;
        }