2
0
Эх сурвалжийг харах

Repeater.cs: fixed ConnectToDataSource method, subscribed to DataSourceViewChanged, looks for a datasource in its parent control
fixed GetData method, should not get data if datasource is null

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

Vladimir Krasnov 19 жил өмнө
parent
commit
896ba68cb4

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

@@ -1,3 +1,9 @@
+2006-06-13  Vladimir Krasnov  <[email protected]>
+
+	* Repeater.cs: fixed ConnectToDataSource method, subscribed to
+	DataSourceViewChanged, looks for a datasource in its parent control
+	fixed GetData method, should not get data if datasource is null
+
 2006-06-13  Konstantin Triger  <[email protected]>
 
 	* ObjectDataSourceView.cs: raise OnDataSourceViewChanged events when data changes.

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

@@ -501,6 +501,9 @@ namespace System.Web.UI.WebControls {
 			if (DataSourceID.Length == 0)
 				return null;
 
+			if (boundDataSource == null)
+				return null;
+
 			DataSourceView dsv = boundDataSource.GetView (String.Empty);
 			dsv.Select (SelectArguments, new DataSourceViewSelectCallback (SelectCallback));
 
@@ -548,8 +551,8 @@ namespace System.Web.UI.WebControls {
 		{
 			/* verify that the data source exists and is an IDataSource */
 			object ctrl = null;
-			if (Page != null)
-				ctrl = Page.FindControl (DataSourceID);
+			if (Parent != null)
+				ctrl = Parent.FindControl (DataSourceID);
 
 			if (ctrl == null || !(ctrl is IDataSource)) {
 				string format;
@@ -563,6 +566,7 @@ namespace System.Web.UI.WebControls {
 			}
 
 			boundDataSource = (IDataSource)ctrl;
+			boundDataSource.GetView (String.Empty).DataSourceViewChanged += new EventHandler(OnDataSourceViewChanged);
 		}
 #endif
 	}