Example #1
0
        internal void InitializeControl(RaControl ctrl)
        {
            // We store all Ra Controls in a list for easily access later down the road...
            RaControls.Add(ctrl);

            // Making sure we only run the initialization logic ONCE...!!
            if (RaControls.Count == 1)
            {
                if (((Page)HttpContext.Current.CurrentHandler).Request.Params["HTTP_X_MICROSOFTAJAX"] != null)
                {
                    return;
                }

                if (IsCallback)
                {
                    // This is a Ra-Ajax callback, we need to wait until the Page Load
                    // events are finished loading and then find the control which
                    // wants to fire an event and do so...
                    ((Page)HttpContext.Current.CurrentHandler).LoadComplete += CurrentPage_LoadComplete;

                    // Checking to see if the Filtering logic has been supressed
                    if (!SupressAjaxFilters)
                    {
                        ((Page)HttpContext.Current.CurrentHandler).Response.Filter = new CallbackFilter(((Page)HttpContext.Current.CurrentHandler).Response.Filter);
                    }
                }
                else
                {
                    ((Page)HttpContext.Current.CurrentHandler).LoadComplete += CurrentPage_LoadComplete_NO_AJAX;

                    // Checking to see if the Filtering logic has been supressed
                    if (!SupressAjaxFilters)
                    {
                        ((Page)HttpContext.Current.CurrentHandler).Response.Filter = new PostbackFilter(((Page)HttpContext.Current.CurrentHandler).Response.Filter);
                    }
                }
            }
        }