소스 검색

2005-09-23 Sebastien Pouliot <[email protected]>

	* DataBindingCollection.cs: Using an hashtable is a nice trick but
	we need to copy values (not the DictionaryEntry) in CopyTo.
	* Page.cs: IsValid throws an exception if the page hasn't be 
	validated. VerifyRenderingInServerForm doesn't throw an exception
	during unit testing (without a context?) but does in normal ops.


svn path=/trunk/mcs/; revision=50651
Sebastien Pouliot 20 년 전
부모
커밋
fcb9fa195e

+ 8 - 0
mcs/class/System.Web/System.Web.UI/ChangeLog

@@ -1,3 +1,11 @@
+2005-09-23  Sebastien Pouliot  <[email protected]>
+
+	* DataBindingCollection.cs: Using an hashtable is a nice trick but
+	we need to copy values (not the DictionaryEntry) in CopyTo.
+	* Page.cs: IsValid throws an exception if the page hasn't be 
+	validated. VerifyRenderingInServerForm doesn't throw an exception
+	during unit testing (without a context?) but does in normal ops.
+
 2005-09-23 Gonzalo Paniagua Javier <[email protected]>
 
 	* LosFormatter.cs: the exceptions thrown have a 500 httpCode. Really

+ 1 - 1
mcs/class/System.Web/System.Web.UI/DataBindingCollection.cs

@@ -81,7 +81,7 @@ namespace System.Web.UI {
 
 		public void CopyTo (Array array, int index)
 		{
-			list.CopyTo (array, index);
+			list.Values.CopyTo (array, index);
 		}
 
 		public IEnumerator GetEnumerator ()

+ 12 - 3
mcs/class/System.Web/System.Web.UI/Page.cs

@@ -76,6 +76,7 @@ public class Page : TemplateControl, IHttpHandler
 	private bool _viewStateMac;
 	private string _errorPage;
 	private bool _isValid;
+	private bool is_validated;
 	private bool _smartNavigation;
 	private int _transactionMode;
 	private HttpContext _context;
@@ -321,9 +322,12 @@ public class Page : TemplateControl, IHttpHandler
 
 	[DesignerSerializationVisibility (DesignerSerializationVisibility.Hidden)]
 	[Browsable (false)]
-	public bool IsValid
-	{
-		get { return _isValid; }
+	public bool IsValid {
+		get {
+			if (!is_validated)
+				throw new HttpException (Locale.GetText ("Page hasn't been validated."));
+			return _isValid;
+		}
 	}
 
 	[EditorBrowsable (EditorBrowsableState.Never)]
@@ -1220,6 +1224,7 @@ public class Page : TemplateControl, IHttpHandler
 
 	public virtual void Validate ()
 	{
+		is_validated = true;
 		ValidateCollection (_validators);
 	}
 
@@ -1261,6 +1266,9 @@ public class Page : TemplateControl, IHttpHandler
 	[EditorBrowsable (EditorBrowsableState.Advanced)]
 	public virtual void VerifyRenderingInServerForm (Control control)
 	{
+		if (_context == null)
+			return;
+
 		if (!renderingForm)
 			throw new HttpException ("Control '" +
 						 control.ClientID +
@@ -1497,6 +1505,7 @@ public class Page : TemplateControl, IHttpHandler
 	
 	public virtual void Validate (string validationGroup)
 	{
+		is_validated = true;
 		if (validationGroup == null || validationGroup == "")
 			ValidateCollection (_validators);
 		else {