|
|
@@ -47,6 +47,7 @@ namespace System.Web.UI.WebControls {
|
|
|
private object source;
|
|
|
#if NET_2_0
|
|
|
//private string dataSourceId;
|
|
|
+ IDataSource boundDataSource = null;
|
|
|
private bool initialized;
|
|
|
private bool requiresDataBinding;
|
|
|
private DataSourceSelectArguments selectArguments;
|
|
|
@@ -365,20 +366,10 @@ namespace System.Web.UI.WebControls {
|
|
|
if (DataSourceID.Length == 0)
|
|
|
return null;
|
|
|
|
|
|
- IDataSource ds = null;
|
|
|
+ if (boundDataSource == null)
|
|
|
+ ConnectToDataSource ();
|
|
|
|
|
|
- if (NamingContainer != null)
|
|
|
- ds = (NamingContainer.FindControl (DataSourceID) as IDataSource);
|
|
|
-
|
|
|
- if (ds == null) {
|
|
|
- if (Parent != null)
|
|
|
- ds = (Parent.FindControl (DataSourceID) as IDataSource);
|
|
|
-
|
|
|
- if (ds == null)
|
|
|
- throw new HttpException (Locale.GetText ("Coulnd't find a DataSource named '{0}'.", DataSourceID));
|
|
|
- }
|
|
|
-
|
|
|
- DataSourceView dsv = ds.GetView (String.Empty);
|
|
|
+ DataSourceView dsv = boundDataSource.GetView (String.Empty);
|
|
|
dsv.Select (SelectArguments, new DataSourceViewSelectCallback (SelectCallback));
|
|
|
return data;
|
|
|
}
|
|
|
@@ -408,6 +399,9 @@ namespace System.Web.UI.WebControls {
|
|
|
if ((Page != null) && !Page.IsPostBack)
|
|
|
RequiresDataBinding = true;
|
|
|
|
|
|
+ if (IsBoundUsingDataSourceID)
|
|
|
+ ConnectToDataSource ();
|
|
|
+
|
|
|
initialized = true;
|
|
|
base.OnLoad (e);
|
|
|
}
|
|
|
@@ -476,5 +470,23 @@ namespace System.Web.UI.WebControls {
|
|
|
return false;
|
|
|
}
|
|
|
}
|
|
|
+
|
|
|
+#if NET_2_0
|
|
|
+ void ConnectToDataSource ()
|
|
|
+ {
|
|
|
+ if (NamingContainer != null)
|
|
|
+ boundDataSource = (NamingContainer.FindControl (DataSourceID) as IDataSource);
|
|
|
+
|
|
|
+ if (boundDataSource == null) {
|
|
|
+ if (Parent != null)
|
|
|
+ boundDataSource = (Parent.FindControl (DataSourceID) as IDataSource);
|
|
|
+
|
|
|
+ if (boundDataSource == null)
|
|
|
+ throw new HttpException (Locale.GetText ("Coulnd't find a DataSource named '{0}'.", DataSourceID));
|
|
|
+ }
|
|
|
+ DataSourceView dsv = boundDataSource.GetView (String.Empty);
|
|
|
+ dsv.DataSourceViewChanged += new EventHandler (OnDataSourceViewChanged);
|
|
|
+ }
|
|
|
+#endif
|
|
|
}
|
|
|
}
|