Author: kostat
Date: 2006-04-20 05:01:57 -0400 (Thu, 20 Apr 2006)
New Revision: 59687

Modified:
   trunk/mcs/class/System.Web/System.Web.UI.WebControls/ChangeLog
   
trunk/mcs/class/System.Web/System.Web.UI.WebControls/CompositeDataBoundControl.cs
   trunk/mcs/class/System.Web/System.Web.UI.WebControls/Menu.cs
   trunk/mcs/class/System.Web/System.Web.UI.WebControls/MenuItem.cs
Log:
MenuItem.cs: bind to NavigateUrl; CompositeDataBoundControl.cs: ensures data is 
bound; Menu.cs: fixed binding

Modified: trunk/mcs/class/System.Web/System.Web.UI.WebControls/ChangeLog
===================================================================
--- trunk/mcs/class/System.Web/System.Web.UI.WebControls/ChangeLog      
2006-04-20 08:30:22 UTC (rev 59686)
+++ trunk/mcs/class/System.Web/System.Web.UI.WebControls/ChangeLog      
2006-04-20 09:01:57 UTC (rev 59687)
@@ -1,3 +1,14 @@
+2006-04-20  Konstantin Triger  <[EMAIL PROTECTED]>
+
+       * MenuItem.cs: when binding to IHierarchyData, check whether 
+               it implements INavigateUIData and retrieve NavigateUrl.
+       * CompositeDataBoundControl.cs: ensures data is bound before creating 
child controls.
+       * Menu.cs:
+               Enable DataBinding by not throwing NotImplementedException in 
OnDataBound event. 
+               Provide basic CreateChildControls implementation by ensuring 
the control is bound. 
+               Ensure the child controls are created when the postback event 
is raised. 
+               Provide default implementation for SkipLinkText to let the 
default functionality to work.
+
 2006-04-11  Lluis Sanchez  <[EMAIL PROTECTED]>
 
        * TreeNodeBinding.cs: Added HasPropertyValue property

Modified: 
trunk/mcs/class/System.Web/System.Web.UI.WebControls/CompositeDataBoundControl.cs
===================================================================
--- 
trunk/mcs/class/System.Web/System.Web.UI.WebControls/CompositeDataBoundControl.cs
   2006-04-20 08:30:22 UTC (rev 59686)
+++ 
trunk/mcs/class/System.Web/System.Web.UI.WebControls/CompositeDataBoundControl.cs
   2006-04-20 09:01:57 UTC (rev 59687)
@@ -53,10 +53,13 @@
                {
                        base.CreateChildControls ();
 
-                       if (Page.IsPostBack) {
-                               object[] data = new object [(int)ViewState 
["_ItemCount"]];
+                       object itemCount = ViewState ["_ItemCount"];
+                       if (itemCount != null) {
+                               object [] data = new object [(int) itemCount];
                                ViewState ["_ItemCount"] = CreateChildControls 
(data, false);
                        }
+                       else
+                               EnsureDataBound ();
                }
                
                protected internal override void PerformDataBinding 
(IEnumerable data)

Modified: trunk/mcs/class/System.Web/System.Web.UI.WebControls/Menu.cs
===================================================================
--- trunk/mcs/class/System.Web/System.Web.UI.WebControls/Menu.cs        
2006-04-20 08:30:22 UTC (rev 59686)
+++ trunk/mcs/class/System.Web/System.Web.UI.WebControls/Menu.cs        
2006-04-20 09:01:57 UTC (rev 59687)
@@ -99,10 +99,10 @@
                        }
                }
 
-           [DefaultValueAttribute (null)]
+           [DefaultValueAttribute (null)]
                [PersistenceMode (PersistenceMode.InnerProperty)]
-           [EditorAttribute 
("System.Web.UI.Design.WebControls.MenuBindingsEditor, " + 
Consts.AssemblySystem_Design, "System.Drawing.Design.UITypeEditor, " + 
Consts.AssemblySystem_Drawing)]
-           [MergablePropertyAttribute (false)]
+           [EditorAttribute 
("System.Web.UI.Design.WebControls.MenuBindingsEditor, " + 
Consts.AssemblySystem_Design, "System.Drawing.Design.UITypeEditor, " + 
Consts.AssemblySystem_Drawing)]
+           [MergablePropertyAttribute (false)]
                public MenuItemBindingCollection DataBindings {
                        get {
                                if (dataBindings == null) {
@@ -142,7 +142,7 @@
                        }
                }
 
-           [DefaultValueAttribute ("")]
+           [DefaultValueAttribute ("")]
                public string DynamicItemFormatString {
                        get {
                                object o = ViewState 
["DynamicItemFormatString"];
@@ -225,7 +225,7 @@
                        }
                }
 
-           [DefaultValueAttribute ("")]
+           [DefaultValueAttribute ("")]
                public string StaticItemFormatString {
                        get {
                                object o = ViewState ["StaticItemFormatString"];
@@ -670,11 +670,14 @@
                [Localizable (true)]
                public string SkipLinkText 
                {
-                       get {
-                               throw new NotImplementedException ();
+                       get {
+                               object o = ViewState ["SkipLinkText"];
+                               if (o != null)
+                                       return (string) o;
+                               return String.Empty;
                        }
-                       set {
-                               throw new NotImplementedException ();
+                       set {
+                               ViewState ["SkipLinkText"] = value;
                        }
                }
                
@@ -760,6 +763,10 @@
                
                protected internal virtual void RaisePostBackEvent (string 
eventArgument)
                {
+                       if (!Enabled)
+                               return;
+
+                       EnsureChildControls();
                        MenuItem item = FindItemByPos (eventArgument);
                        if (item == null) return;
                        item.Selected = true;
@@ -917,7 +924,8 @@
                
                protected internal override void CreateChildControls ()
                {
-                       base.CreateChildControls ();
+                       Controls.Clear ();
+                       EnsureDataBound ();
                }
                
                protected override void EnsureDataBound ()
@@ -955,7 +963,7 @@
                [MonoTODO]
                protected override void OnDataBinding (EventArgs e)
                {
-                       throw new NotImplementedException ();
+                       base.OnDataBinding (e);
                }
                
                protected internal override void OnPreRender (EventArgs e)

Modified: trunk/mcs/class/System.Web/System.Web.UI.WebControls/MenuItem.cs
===================================================================
--- trunk/mcs/class/System.Web/System.Web.UI.WebControls/MenuItem.cs    
2006-04-20 08:30:22 UTC (rev 59686)
+++ trunk/mcs/class/System.Web/System.Web.UI.WebControls/MenuItem.cs    
2006-04-20 09:01:57 UTC (rev 59687)
@@ -352,8 +352,8 @@
                        }
                }
                
-           [BrowsableAttribute (true)]
-           [DefaultValueAttribute (true)]
+           [BrowsableAttribute (true)]
+           [DefaultValueAttribute (true)]
                public bool Selectable {
                        get {
                                object o = ViewState ["Selectable"];
@@ -373,8 +373,8 @@
                        }
                }
                
-           [BrowsableAttribute (true)]
-           [DefaultValueAttribute (true)]
+           [BrowsableAttribute (true)]
+           [DefaultValueAttribute (true)]
                public bool Enabled {
                        get {
                                object o = ViewState ["Enabled"];
@@ -532,6 +532,9 @@
                        dataBound = true;
                        dataPath = hierarchyData.Path;
                        dataItem = hierarchyData.Item;
+                       INavigateUIData navigateUIData = hierarchyData as 
INavigateUIData;
+                       if (navigateUIData != null)
+                               NavigateUrl = navigateUIData.NavigateUrl;
                }
                
                internal void SetDataItem (object item)

_______________________________________________
Mono-patches maillist  -  [email protected]
http://lists.ximian.com/mailman/listinfo/mono-patches

Reply via email to