Hello!
I have 5 objects:
object 1 is root, object 2 and 3 in subroot, objects 4,5 in subsubroot :)
here is the hierarchy:
object1
object2
object4
object3
object5
Is it possible to make this hierarchy in xamWebGrid?
Thank you.
Sorry, I`ve forgot to write some words.
object1 is root for objects2 and object3
object 4 is child for the object2
and object5 is child for object3
for example :
class1 { public object object2; public object object3;}
class2 { public object object4; }
class3 { public object object5;}
thank you.
Hello,
I can see no reason why this is not possible. You need to create a hierarchy of classes, where the parent has a property, which is a collection of sub objects. Something like this:
public class ParentObject
{
public List<SubObject> Sub { get; set; }
}
public class SubObject
public List<SubSubObject> SubSub { get; set; }
public class SubSubObject
public string ID { get; set; }
Set the AutoGenerateColumns="True" property of the XamWebGrid to true and you are all set
Thank you Stephen!
You helped me much.
Hi,
So, basically the grid is made up of Columns. And a column represents a public property in your data. When AutoGenerateColumns is turned on (and it is by default). The xamWebGrid looks at an object in your data source, and determines the Columns that it needs to create. For example for a bool property the xamWebGrid will create a CheckBoxColumn.
Now, the important thing to take away from this, is that when the xamWebGrid comes across an IEnumerable property, it will create a ColumnLayout. And a ColumnLayout represents another level of data and Columns.
The xamWebGrid does support multiple childBands, so all you need to do, is have 2 properties in your data object of type IEnumerable, one a collection of sub_object1 and the other a collection of sub_object2, and the xamWebGrid will do the rest.
The following help articles actually go into greater detail and might help explain things a little better.
Columns
Defining ColumnLayouts
Hope this helps,
-SteveZ
Hello.
Sorry, I don`t get about this case of hierarchy:
root_object
sub_object1
sub_object2
Is it possible for xamWebGrid?
Thank you very much!
Thank you, Alex.
You helped me much!