AjaxControlToolkit.Accordion.OnPagePreLoad C# (CSharp) Method

OnPagePreLoad() private method

private OnPagePreLoad ( object sender, EventArgs e ) : void
sender object
e System.EventArgs
return void
        void OnPagePreLoad(object sender, EventArgs e)
        {
            _initialized = true;

            if(Page != null) {
                Page.PreLoad -= new EventHandler(this.OnPagePreLoad);

                // Setting RequiresDataBinding to true in OnLoad is too late because the OnLoad page event
                // happens before the control.OnLoad method gets called.  So a page_load handler on the page
                // that calls DataBind won't prevent DataBind from getting called again in PreRender.
                if(!Page.IsPostBack)
                    RequiresDataBinding = true;

                // If this is a postback and viewstate is enabled, but we have never bound the control
                // before, it is probably because its visibility was changed in the postback.  In this
                // case, we need to bind the control or it will never appear.  This is a common scenario
                // for Wizard and MultiView.
                if(Page.IsPostBack && IsViewStateEnabled && ViewState[ItemCountViewStateKey] == null)
                    RequiresDataBinding = true;

                _pagePreLoadFired = true;
            }

            EnsureChildControls();
        }