Beispiel #1
0
        private void OnPageInitComplete(object sender, EventArgs e)
        {
            StaticCallBackProxy.RegisterStaticCallbackProxyControl(this.Page);

            if (InvokeWithoutViewState)
            {
                Type baseType = ScriptControlHelper.GetBasePageTypeInfo(this.Page.GetType());

                string callbackControlID = HttpContext.Current.Request["__CALLBACKID"];

                if (string.IsNullOrEmpty(callbackControlID) == false)
                {
                    try
                    {
                        baseType.GetMethod("PrepareCallback",
                                           BindingFlags.Instance | BindingFlags.NonPublic).Invoke(this.Page, new object[] { callbackControlID });

                        baseType.GetMethod("RenderCallback",
                                           BindingFlags.Instance | BindingFlags.NonPublic).Invoke(this.Page, null);
                    }
                    finally
                    {
                        HttpContext.Current.Response.End();
                    }
                }
            }
        }
Beispiel #2
0
        /// <summary>
        /// 获取客户端脚本控件所需脚本资源引用集合
        /// Gets the script references for this control
        /// </summary>
        /// <returns>脚本资源引用集合</returns>
        protected virtual IEnumerable <ScriptReference> GetScriptReferences()
        {
            if (!IsRenderScript)
            {
                return(null);
            }

            return(ScriptControlHelper.GetScriptReferences(this.GetType(), this.ScriptPath));
        }
Beispiel #3
0
        /// <summary>
        /// Gets the script references for this control
        /// </summary>
        /// <returns></returns>
        protected override IEnumerable <ScriptReference> GetScriptReferences()
        {
            //if (!Visible || ReadOnly) return null;
            if (!Visible)
            {
                return(null);
            }

            return(ScriptControlHelper.GetScriptReferences(this.GetType(), this.ScriptPath));
        }
Beispiel #4
0
        /// <summary>
        /// 重载OnInit,增加事件
        /// </summary>
        /// <param name="e">事件参数</param>
        protected override void OnInit(EventArgs e)
        {
            ScriptControlHelper.CheckOnlyRenderSelf(this, this.RenderMode);

            if (Page != null)
            {
                Page.InitComplete += new EventHandler(OnPageInitComplete);
            }

            base.OnInit(e);

            if (Page != null)
            {
                Page.PreLoad           += new EventHandler(OnPagePreLoad);
                Page.PreRenderComplete += new EventHandler(OnPagePreRenderComplete);
            }
        }
Beispiel #5
0
        /// <summary>
        /// Ensures a ScriptManager exists on the Page for this Control
        /// </summary>
        private void EnsureScriptManager()
        {
            ScriptControlHelper.EnsureScriptManager(ref this._scriptManager, this.Page);

            //if (_scriptManager == null)
            //{
            //    _scriptManager = ScriptManager.GetCurrent(Page);
            //    if (_scriptManager == null)
            //    {
            //        ExceptionHelper.TrueThrow(this.Page.Form.Controls.IsReadOnly, Resources.DeluxeWebResource.E_NoScriptManager);

            //        _scriptManager = new ScriptManager();
            //        _scriptManager.ScriptMode = ScriptMode.Release;
            //        _scriptManager.EnableScriptGlobalization = true;
            //        this.Page.Form.Controls.Add(_scriptManager);
            //        //throw new HttpException(Resources.DeluxeWebResource.E_NoScriptManager);
            //    }
            //}
        }
Beispiel #6
0
 /// <summary>
 /// Ensures a ScriptManager exists on the Page for this Control
 /// </summary>
 private void EnsureScriptManager()
 {
     ScriptControlHelper.EnsureScriptManager(ref this._scriptManager, this.Page);
 }
Beispiel #7
0
 /// <summary>
 /// 在页面Load之前,确保ScriptManager加载
 /// </summary>
 /// <param name="sender">事件触发对象</param>
 /// <param name="e">事件参数</param>
 protected virtual void OnPagePreLoad(object sender, EventArgs e)
 {
     //EnsureScriptManager();
     ScriptControlHelper.EnsureScriptManager(ref this._scriptManager, this.Page);
 }
Beispiel #8
0
 /// <summary>
 /// 重载OnInit,增加事件
 /// </summary>
 /// <param name="e">事件参数</param>
 protected override void OnInit(EventArgs e)
 {
     ScriptControlHelper.CheckOnlyRenderSelf(this, this.RenderMode);
     base.OnInit(e);
 }