private void OnPageInitComplete(object sender, EventArgs e) { 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(); } } } }
/// <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); } }
/// <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); // } //} }
/// <summary> /// 重载OnInit,增加事件 /// </summary> /// <param name="e">事件参数</param> protected override void OnInit(EventArgs e) { ScriptControlHelper.CheckOnlyRenderSelf(this, this.RenderMode); base.OnInit(e); }
/// <summary> /// Ensures a ScriptManager exists on the Page for this Control /// </summary> private void EnsureScriptManager() { ScriptControlHelper.EnsureScriptManager(ref this._scriptManager, this.Page); }