BaseDataList.cs: added ConnectToDataSource method that called from OnLoad, fixed...
authorVladimir Krasnov <krasnov@mono-cvs.ximian.com>
Wed, 14 Jun 2006 16:37:50 +0000 (16:37 -0000)
committerVladimir Krasnov <krasnov@mono-cvs.ximian.com>
Wed, 14 Jun 2006 16:37:50 +0000 (16:37 -0000)
Wizard.cs: fixed bug when called MoveTo after that control hierarchy has been created

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

mcs/class/System.Web/System.Web.UI.WebControls/BaseDataList.cs
mcs/class/System.Web/System.Web.UI.WebControls/ChangeLog
mcs/class/System.Web/System.Web.UI.WebControls/Wizard.cs

index b46c19dc91b670c85ea9190504090c5c08b6dff3..02a27c347a2e37990bbdbb378f03f1e4ce699605 100644 (file)
@@ -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
        }
 }
index e2828db7135456716d2db0a3b0abe06fdff7cbd1..eb1cd6393d3bbd916bcdaf2a10f752f878e8919f 100644 (file)
@@ -1,3 +1,10 @@
+2006-06-14  Vladimir Krasnov  <vladimirk@mainsoft.com>
+
+       * BaseDataList.cs: added ConnectToDataSource method that called from 
+       OnLoad, fixed GetData method
+       * Wizard.cs: fixed bug when called MoveTo after that control hierarchy
+       has been created
+
 2006-06-14  Andrew Skiba <andrews@mainsoft.com>
 
        * Menu.cs: add CssStyle value to the rendered class attribute
index 6864bb0eb1ac8a5c95363896ee4ce0696d707bbf..aef03eb10caf0ee12efd1f80dd7493d44d6d9d4b 100644 (file)
@@ -1219,6 +1219,9 @@ namespace System.Web.UI.WebControls
                
                protected internal override void Render (HtmlTextWriter writer)
                {
+                       if (multiView.ActiveViewIndex != ActiveStepIndex)
+                               CreateControlHierarchy ();
+
                        wizardTable.ApplyStyle (ControlStyle);
 
                        foreach (object[] styleDef in styles)