Browse Source

Change the implementation of CreateControlHierarchy().
The current implementation renders extra Header and footer
without Repeater.DataSource assign.

svn path=/trunk/mcs/; revision=21165

Alon Gazit 22 years ago
parent
commit
c5a41569cd

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

@@ -1,3 +1,9 @@
+2003-12-15  Alon Gazit <[email protected]>
+	* Repeater.cs: Change the implementation of CreateControlHierarchy().
+	The current implementation renders extra Header and footer 
+	without Repeater.DataSource assign. 
+	This fixes bug #52179.
+
 2003-12-15  Alon Gazit <[email protected]>
 	* DataGrid.cs: Change the implementation of the property 
 	BackImageUrl. The current implementation has no influence 

+ 8 - 8
mcs/class/System.Web/System.Web.UI.WebControls/Repeater.cs

@@ -314,11 +314,11 @@ namespace System.Web.UI.WebControls
 					ds = new DataSourceInternal (itemCount);
 			}
 
-			if (headerTemplate != null)
-				CreateItem (-1, ListItemType.Header, useDataSource, null);
-
 			int index = 0;
-			if (ds != null) {
+			if (ds != null) {
+				if (headerTemplate != null)
+					CreateItem (-1, ListItemType.Header, useDataSource, null);
+				
 				bool even = true;
 				foreach (object item in ds){
 					if (separatorTemplate != null && index > 0)
@@ -336,12 +336,12 @@ namespace System.Web.UI.WebControls
 					itemsArrayList.Add (repeaterItem);
 					index++;
 					even = !even;
-				}
+				}
+				
+				if (footerTemplate != null)
+					CreateItem (-1, ListItemType.Footer, useDataSource, null);
 			}
 
-			if (footerTemplate != null)
-				CreateItem (-1, ListItemType.Footer, useDataSource, null);
-
 			if (useDataSource)
 				ViewState [ITEMCOUNT] = (ds == null) ? -1 : index;
 		}