refactoring: Button, ImageButton and LinkButton are used insted internal DataControlB...
[mono.git] / mcs / class / System.Web / System.Web.UI.WebControls / XmlHierarchyData.cs
index 755c3c17928da77e5e80773f5b12993eeb562cca..42de7beefd9d25f1975932c255897a88f336a536 100644 (file)
@@ -127,11 +127,9 @@ namespace System.Web.UI.WebControls {
                        return new XmlHierarchicalEnumerable (item.ChildNodes);
                }
                
-               IHierarchicalEnumerable IHierarchyData.GetParent ()
+               IHierarchyData IHierarchyData.GetParent ()
                {
-                       if (item.ParentNode == null)
-                               return null;
-                       return new XmlHierarchicalEnumerable (item.ParentNode.ChildNodes);
+                       return new XmlHierarchyData (item.ParentNode);
                }
                
                bool IHierarchyData.HasChildren {
@@ -142,9 +140,24 @@ namespace System.Web.UI.WebControls {
                        get { return item; }
                }
                
-               [MonoTODO]
                string IHierarchyData.Path {
-                       get { throw new NotImplementedException (); }
+                       get { 
+                               System.Text.StringBuilder sb = new System.Text.StringBuilder();
+                               XmlNode nod = item;
+                               do {
+                                       int n=1;
+                                       XmlNode prev = nod.PreviousSibling;
+                                       while (prev != null) {
+                                               prev = prev.PreviousSibling;
+                                               n++;
+                                       }
+
+                                       sb.Insert (0, "/*[position()=" + n + "]");
+                                       nod = nod.ParentNode;
+                               } while (nod != null && !(nod is XmlDocument));
+                               
+                               return sb.ToString ();
+                       }
                }
                
                string IHierarchyData.Type {