From: Argiris K. <be...@us...> - 2005-12-18 16:44:55
|
Update of /cvsroot/magicajax/magicajax/Core/UI/Controls In directory sc8-pr-cvs1.sourceforge.net:/tmp/cvs-serv25522/Core/UI/Controls Modified Files: AjaxPanel.cs Added Files: AjaxZone.cs Log Message: -Added 'AjaxType' MagicAjax attribute for controls -Added 'ExcludeFlags' MagicAjax attribute for controls -Added AjaxZone control. Index: AjaxPanel.cs =================================================================== RCS file: /cvsroot/magicajax/magicajax/Core/UI/Controls/AjaxPanel.cs,v retrieving revision 1.38 retrieving revision 1.39 diff -C2 -d -r1.38 -r1.39 *** AjaxPanel.cs 13 Dec 2005 06:23:02 -0000 1.38 --- AjaxPanel.cs 18 Dec 2005 16:44:46 -0000 1.39 *************** *** 113,139 **** public AjaxCallConnectionType AjaxCallConnection { ! get ! { ! return _ajaxCallConnection; ! } ! set ! { ! _ajaxCallConnection = value; ! ! switch (_ajaxCallConnection) ! { ! case AjaxCallConnectionType.None: ! this.Attributes.Remove ("AjaxCall"); ! break; ! ! case AjaxCallConnectionType.Asynchronous: ! this.Attributes["AjaxCall"] = "async"; ! break; ! ! case AjaxCallConnectionType.Synchronous: ! this.Attributes["AjaxCall"] = "sync"; ! break; ! } ! } } #endregion --- 113,118 ---- public AjaxCallConnectionType AjaxCallConnection { ! get { return _ajaxCallConnection; } ! set { _ajaxCallConnection = value; } } #endregion *************** *** 168,172 **** if ( IsPageNoStoreMode ) { ! return (HttpContext.Current.Request.Form[ControlCollectionState.GetControlFingerprintsField(this.ClientID)] != String.Empty); } else --- 147,151 ---- if ( IsPageNoStoreMode ) { ! return ( Context.Request.Form[ControlCollectionState.GetControlFingerprintsField(this.ClientID)] != String.Empty); } else *************** *** 206,209 **** --- 185,204 ---- #endregion + #region override OnPreRender + protected override void OnPreRender(EventArgs e) + { + base.OnPreRender (e); + SetAjaxAttributes(); + } + #endregion + + #region override OnPreWriteScript + protected override void OnPreWriteScript(EventArgs e) + { + base.OnPreWriteScript (e); + SetAjaxAttributes(); + } + #endregion + #region override OnUnload protected override void OnUnload(EventArgs e) *************** *** 334,342 **** #endregion protected virtual void SaveControlState() { //note:only for NoStore mode ! _controlState.SetControlIDs(_controlHtmlFingerprints); ! _controlState.Save (this.ClientID, this.Page); } --- 329,358 ---- #endregion + protected virtual void SetAjaxAttributes() + { + switch (_ajaxCallConnection) + { + case AjaxCallConnectionType.None: + this.Attributes.Remove ("AjaxCall"); + break; + + case AjaxCallConnectionType.Asynchronous: + this.Attributes["AjaxCall"] = "async"; + break; + + case AjaxCallConnectionType.Synchronous: + this.Attributes["AjaxCall"] = "sync"; + break; + } + } + protected virtual void SaveControlState() { //note:only for NoStore mode ! if ( _controlState != null ) ! { ! _controlState.SetControlIDs(_controlHtmlFingerprints); ! _controlState.Save (this.ClientID, this.Page); ! } } *************** *** 347,351 **** if (_controlState == null) { ! throw new MagicAjaxException(String.Format("The control fingerprints for AjaxPanel '{0}' is not rendered on page.", this.ClientID)); } --- 363,370 ---- if (_controlState == null) { ! // The control fingerprints were excluded from the post data. ! // There will be no evaluation of 'html holders'; all the contents ! // of the AjaxPanel will be sent to client in one javascript command. ! return; } *************** *** 621,625 **** bool allControlsAreNew = (Controls.Count == _addedControls.Count); ! if ( ! this.IsRenderedOnPage || allControlsAreNew ) { // Render all the controls in a single html rendering. --- 640,644 ---- bool allControlsAreNew = (Controls.Count == _addedControls.Count); ! if ( ! this.IsRenderedOnPage || allControlsAreNew || _controlState == null ) { // Render all the controls in a single html rendering. *************** *** 668,672 **** } ! _controlState.LiteralFingerprint = Util.GetFingerprint(sbLiteral.ToString()); } else --- 687,692 ---- } ! if ( _controlState != null ) ! _controlState.LiteralFingerprint = Util.GetFingerprint(sbLiteral.ToString()); } else --- NEW FILE: AjaxZone.cs --- using System; using System.Web.UI; using System.ComponentModel; namespace MagicAjax.UI.Controls { public enum ExcludeFromPostFlag { /// <summary> /// Post all elements /// </summary> None = 0, /// <summary> /// Do not post ViewState /// </summary> ViewState = 1, /// <summary> /// Do not post the control fingerprints hidden fields /// </summary> Fingerprints = 2, /// <summary> /// Do not post the custom hidden fields of the user /// </summary> UserHidden = 4, /// <summary> /// Do not post any hidden field /// </summary> AllHidden = 7, /// <summary> /// Do not post any (non-hidden) form element /// </summary> FormElements = 8, /// <summary> /// Do not post any element /// </summary> AllElements = 15 } /// <summary> /// Summary description for AjaxZone. /// </summary> public class AjaxZone : AjaxPanel { private ExcludeFromPostFlag _excludeFlags = ExcludeFromPostFlag.None; [Bindable(false), Category("Behaviour"), DefaultValue(ExcludeFromPostFlag.None)] public ExcludeFromPostFlag ExcludeFlags { get { return _excludeFlags; } set { _excludeFlags = value; } } protected override void SetAjaxAttributes() { base.SetAjaxAttributes (); if (_excludeFlags == ExcludeFromPostFlag.None) { this.Attributes.Remove ("ExcludeFlags"); } else { this.Attributes["ExcludeFlags"] = ((int)_excludeFlags).ToString(); } } protected override void OnLoad(EventArgs e) { base.OnLoad (e); this.Attributes["AjaxType"] = "ajaxzone"; } } } |