Răsfoiți Sursa

2003-10-25 Ben Maurer <[email protected]>

	* DataGrid.cs: A few typos kept us from viewing datagrids
	that were based on customized collections.

svn path=/trunk/mcs/; revision=19391
Ben Maurer 22 ani în urmă
părinte
comite
ea36645191

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

@@ -1,3 +1,8 @@
+2003-10-25 Ben Maurer  <[email protected]>
+
+	* DataGrid.cs: A few typos kept us from viewing datagrids
+	that were based on customized collections.
+
 2003-10-24 Ben Maurer  <[email protected]>
 
 	* DataGridCommandEventArgs.cs: typo, cmdSrc was becoming origionalArgs.

+ 20 - 18
mcs/class/System.Web/System.Web.UI.WebControls/DataGrid.cs

@@ -1429,6 +1429,7 @@ namespace System.Web.UI.WebControls
 				BoundColumn b_col;
 				if(props == null)
 				{
+					object fitem = null;
 					prop_type   = null;
 					PropertyInfo prop_item =  source.DataSource.GetType().GetProperty("Item",
 					          BindingFlags.Instance | BindingFlags.Static |
@@ -1439,9 +1440,9 @@ namespace System.Web.UI.WebControls
 					{
 						prop_type = prop_item.PropertyType;
 					}
-					if(prop_type != null && prop_type == typeof(object))
+					if(prop_type == null || prop_type == typeof(object))
 					{
-						object fitem = null;
+						
 						IEnumerator en = source.GetEnumerator();
 						if(en.MoveNext())
 							fitem = en.Current;
@@ -1450,26 +1451,27 @@ namespace System.Web.UI.WebControls
 							prop_type = fitem.GetType();
 						}
 						StoreEnumerator(en, fitem);
-						if(fitem != null && fitem is ICustomTypeDescriptor)
+					}
+					
+					if(fitem != null && fitem is ICustomTypeDescriptor)
+					{
+						props = TypeDescriptor.GetProperties(fitem);
+					} else if(prop_type != null) {
+						if(IsBindableType(prop_type))
 						{
-							props = TypeDescriptor.GetProperties(fitem);
-						} else if(prop_type != null)
+							b_col = new BoundColumn();
+							// b_col.TrackViewState();
+							b_col.HeaderText = "Item";
+							b_col.SortExpression = "Item";
+							b_col.DataField  = BoundColumn.thisExpr;
+							b_col.SetOwner(this);
+							retVal.Add(b_col);
+						} else
 						{
-							if(IsBindableType(prop_type))
-							{
-								b_col = new BoundColumn();
-								// b_col.TrackViewState();
-								b_col.HeaderText = "Item";
-								b_col.SortExpression = "Item";
-								b_col.DataField  = BoundColumn.thisExpr;
-								b_col.SetOwner(this);
-								retVal.Add(b_col);
-							} else
-							{
-								props = TypeDescriptor.GetProperties(prop_type);
-							}
+							props = TypeDescriptor.GetProperties(prop_type);
 						}
 					}
+					
 				}
 				if(props != null && props.Count > 0)
 				{