From: Argiris K. <be...@us...> - 2005-11-30 12:22:48
|
Update of /cvsroot/magicajax/magicajax/Core/UI In directory sc8-pr-cvs1.sourceforge.net:/tmp/cvs-serv5437/Core/UI Modified Files: AjaxControl.cs AjaxPage.cs AjaxUserControl.cs RenderedByScriptControl.cs Log Message: --Fixed the javascript errors that occured when the browser was not supported. Added a 'IsBrowserSupported' check before any MagicAjax specific additions on the page. --An exception is thrown if MagicAjaxModule is not included in the HttpModules of web.config and the code tries to access MagicAjaxContext.Current . MagicAjaxContext is being created by MagicAjaxModule at the BeginRequest event. --Added 'MagicAjaxContext' protected property in AjaxControl, AjaxPage and AjaxUserControl classes and use it in the Ajax controls instead of MagicAjaxContext.Current Index: AjaxUserControl.cs =================================================================== RCS file: /cvsroot/magicajax/magicajax/Core/UI/AjaxUserControl.cs,v retrieving revision 1.8 retrieving revision 1.9 diff -C2 -d -r1.8 -r1.9 *** AjaxUserControl.cs 23 Nov 2005 15:19:29 -0000 1.8 --- AjaxUserControl.cs 30 Nov 2005 12:22:29 -0000 1.9 *************** *** 35,38 **** --- 35,40 ---- public class AjaxUserControl : System.Web.UI.UserControl, IAjaxCallEventHandler { + private MagicAjaxContext _magicAjaxContext; + /// <summary> /// Raised by MagicAjaxModule when an AjaxCall occurs *************** *** 76,79 **** --- 78,92 ---- } + protected MagicAjaxContext MagicAjaxContext + { + get { return _magicAjaxContext; } + } + + protected override void OnInit(EventArgs e) + { + _magicAjaxContext = MagicAjaxContext.Current; + base.OnInit (e); + } + protected virtual void OnAjaxCall(EventArgs e) { Index: AjaxPage.cs =================================================================== RCS file: /cvsroot/magicajax/magicajax/Core/UI/AjaxPage.cs,v retrieving revision 1.7 retrieving revision 1.8 diff -C2 -d -r1.7 -r1.8 *** AjaxPage.cs 23 Nov 2005 15:12:48 -0000 1.7 --- AjaxPage.cs 30 Nov 2005 12:22:29 -0000 1.8 *************** *** 35,38 **** --- 35,40 ---- public class AjaxPage : System.Web.UI.Page, IAjaxCallEventHandler { + private MagicAjaxContext _magicAjaxContext; + /// <summary> /// Raised by MagicAjaxModule when an AjaxCall occurs *************** *** 76,79 **** --- 78,92 ---- } + protected MagicAjaxContext MagicAjaxContext + { + get { return _magicAjaxContext; } + } + + protected override void OnInit(EventArgs e) + { + _magicAjaxContext = MagicAjaxContext.Current; + base.OnInit (e); + } + protected virtual void OnAjaxCall(EventArgs e) { Index: AjaxControl.cs =================================================================== RCS file: /cvsroot/magicajax/magicajax/Core/UI/AjaxControl.cs,v retrieving revision 1.8 retrieving revision 1.9 diff -C2 -d -r1.8 -r1.9 *** AjaxControl.cs 23 Nov 2005 15:12:48 -0000 1.8 --- AjaxControl.cs 30 Nov 2005 12:22:29 -0000 1.9 *************** *** 33,36 **** --- 33,38 ---- public abstract class AjaxControl : System.Web.UI.WebControls.WebControl, IAjaxCallEventHandler { + private MagicAjaxContext _magicAjaxContext; + /// <summary> /// Raised by the MagicAjaxModule. *************** *** 76,82 **** --- 78,91 ---- public AjaxControl() { + _magicAjaxContext = MagicAjaxContext.Current; } public AjaxControl(HtmlTextWriterTag tag) : base(tag) { + _magicAjaxContext = MagicAjaxContext.Current; + } + + protected MagicAjaxContext MagicAjaxContext + { + get { return _magicAjaxContext; } } Index: RenderedByScriptControl.cs =================================================================== RCS file: /cvsroot/magicajax/magicajax/Core/UI/RenderedByScriptControl.cs,v retrieving revision 1.13 retrieving revision 1.14 diff -C2 -d -r1.13 -r1.14 *** RenderedByScriptControl.cs 25 Nov 2005 21:30:26 -0000 1.13 --- RenderedByScriptControl.cs 30 Nov 2005 12:22:29 -0000 1.14 *************** *** 184,188 **** protected override void OnPreRender(EventArgs e) { ! if (!IsChildOfRenderedByScriptControl(this)) { string hiddenStore; --- 184,188 ---- protected override void OnPreRender(EventArgs e) { ! if ( this.MagicAjaxContext.IsBrowserSupported && !IsChildOfRenderedByScriptControl(this)) { string hiddenStore; |