Browse Source

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

	* DataList.cs: fixed: OnBubbleEvent() will return true if event is handled 

svn path=/trunk/mcs/; revision=72614
Igor Zelmanovich 19 years ago
parent
commit
ff3b111d63

+ 4 - 0
mcs/class/System.Web/System.Web.UI.WebControls/ChangeLog

@@ -1,3 +1,7 @@
+2007-02-11 Igor Zelmanovich <[email protected]>
+
+	* DataList.cs: fixed: OnBubbleEvent() will return true if event is handled 
+
 2007-02-09  Gert Driesen  <[email protected]>
 
 	* FontUnit.cs: Fixed ToString () to use current locale.

+ 1 - 6
mcs/class/System.Web/System.Web.UI.WebControls/DataList.cs

@@ -683,22 +683,17 @@ namespace System.Web.UI.WebControls {
 			OnItemCommand (dlca);
 			if (String.Compare (cn, CancelCommandName, true, inv) == 0) {
 				OnCancelCommand (dlca);
-				return true;
 			} else if (String.Compare (cn, DeleteCommandName, true, inv) == 0) {
 				OnDeleteCommand (dlca);
-				return true;
 			} else if (String.Compare (cn, EditCommandName, true, inv) == 0) {
 				OnEditCommand (dlca);
-				return true;
 			} else if (String.Compare (cn, SelectCommandName, true, inv) == 0) {
 				SelectedIndex = dlca.Item.ItemIndex;
 				OnSelectedIndexChanged (dlca);
-				return true;
 			} else if (String.Compare (cn, UpdateCommandName, true, inv) == 0) {
 				OnUpdateCommand (dlca);
-				return true;
 			}
-			return false;
+			return true;
 		}
 
 		protected virtual void OnCancelCommand (DataListCommandEventArgs e)

+ 13 - 2
mcs/class/System.Web/Test/System.Web.UI.WebControls/DataListTest.cs

@@ -138,9 +138,9 @@ namespace MonoTests.System.Web.UI.WebControls {
 			OnSelectedIndexChanged (e);
 		}
 
-		public void DoBubbleEvent (object source, EventArgs e)
+		public bool DoBubbleEvent (object source, EventArgs e)
 		{
-			OnBubbleEvent (source, e);
+			return OnBubbleEvent (source, e);
 		}
 	}
 
@@ -960,6 +960,17 @@ namespace MonoTests.System.Web.UI.WebControls {
 			dl.DoBubbleEvent (this, command_args);
 			Assert.IsTrue (selectedIndexChangedEvent, "selectedIndexChangedEvent-3");
 			Assert.IsTrue (itemCommandEvent, "#00");
+
+			//
+			// any comand
+			//
+			ResetEvents ();
+			command_args = new DataListCommandEventArgs (item, null,
+					new CommandEventArgs ("AnyComand", String.Empty));
+			dl.ItemCommand += new DataListCommandEventHandler (ItemCommandHandler);
+			bool res = dl.DoBubbleEvent (this, command_args);
+			Assert.IsTrue (res, "any comand#00");
+			Assert.IsTrue (itemCommandEvent, "any comand#01");
 		}
 
 		[Test]