I want to bind a grid to a collection of objects. Mostly I will just display properties of the objects. This is simple. But, I also want to display properties of those properties. Is that possible with the ultragrid? Has someone got an example somewhere? Is there instructions for doing this? In a sense what I am asking is how to display heirarchical object data in a flat grid.
This is an example of what I want to display
Task.User.UserName
Task.TaskDate
Task.Status.Description
Task.TaskNumber
etc.
I found a related post here, that relates to binding a list of complex objects (objects with nested sub-objects) and how to display them in stock asp:gridview control, but I am pretty sure the same principles can be tried with UltraWebGrid. The technique revolves around using templated columns and using databinding expressions to map to the respective complex sub-property, e.g. <%# Eval("User.UserName") %>
You just have to make sure you have public properties exposed for the properties you need to use.
More info can be found here:
http://www.velocityreviews.com/forums/t111794-bind-gridview-to-generic-custom-object-list-collection.html
Please, let me know if this helps.
Dude, I want to buy you a new car. That was fantastic! It worked first time. I was on the right track but I didn't realise you could do an Eval in side an ItemTemplate. Do you know how many times I've posted this question on microsoft forums with no response? It's been driving me nuts! Before I read your post I was half way through writing a routine to transform an object in to a datatable based on a transform string to flatten the structure. Truly awesome stuff! I'd been losing sleep on this one.