Example #1
0
        private void RegisterPanel()
        {
            // Safeguard against registering in design mode, and against registering twice
            if (!DesignMode && !_panelRegistered)
            {
                // Before we can register we need to make sure all our parent panel (if any) has
                // registered already. This is critical since the ScriptManager assumes that
                // the panels are registered in a specific order.
                Control parent = Parent;
                while (parent != null)
                {
                    UpdatePanel parentUpdatePanel = parent as UpdatePanel;
                    if (parentUpdatePanel != null)
                    {
                        parentUpdatePanel.RegisterPanel();
                        break;
                    }

                    parent = parent.Parent;
                }

                // Now we can register ourselves
                ScriptManager.RegisterUpdatePanel(this);
                _panelRegistered = true;
            }
        }