瀏覽代碼

2007-02-13 Igor Zelmanovich <[email protected]>

	* ClientScriptManager.cs: EventValidation feature optimization on Callback.


svn path=/trunk/mcs/; revision=72779
Igor Zelmanovich 19 年之前
父節點
當前提交
35e4dec3b5

+ 5 - 1
mcs/class/System.Web/System.Web.UI/ChangeLog

@@ -1,4 +1,8 @@
-2007-02-013 Igor Zelmanovich <[email protected]>
+2007-02-13 Igor Zelmanovich <[email protected]>
+
+	* ClientScriptManager.cs: EventValidation feature optimization on Callback.
+
+2007-02-13 Igor Zelmanovich <[email protected]>
 
 	* Page.cs: fixed exception handling on Callback at client.
 

+ 7 - 1
mcs/class/System.Web/System.Web.UI/ClientScriptManager.cs

@@ -60,6 +60,7 @@ namespace System.Web.UI
 #if NET_2_0
 		List <int> eventValidationValues;
 		Hashtable expandoAttributes;
+		bool _hasRegisteredForEventValidationOnCallback;
 #endif
 		
 		internal ClientScriptManager (Page page)
@@ -425,7 +426,9 @@ namespace System.Web.UI
 				return;
 			if (uniqueId == null || uniqueId.Length == 0)
 				return;
-			if (page.LifeCycle < PageLifeCycle.Render && !page.IsCallback)
+			if (page.IsCallback)
+				_hasRegisteredForEventValidationOnCallback = true;
+			else if (page.LifeCycle < PageLifeCycle.Render)
 				throw new InvalidOperationException ("RegisterForEventValidation may only be called from the Render method");
 			if (eventValidationValues == null)
 				eventValidationValues = new List <int> ();
@@ -501,6 +504,9 @@ namespace System.Web.UI
 			if (eventValidationValues == null || eventValidationValues.Count == 0)
 				return null;
 
+			if(page.IsCallback && !_hasRegisteredForEventValidationOnCallback)
+				return null;
+
 			IStateFormatter fmt = page.GetFormatter ();
 			int [] array = new int [eventValidationValues.Count];
 #if TARGET_JVM // FIXME: No support yet for passing 'int[]' as 'T[]'