views:

45

answers:

2

Hi all,

I am working on a project that pulls data out of an xml files and also uses a tree-grid combination in order to display the data. For example depending on the selected treeview node, the datagridview will display only the records related to that node.

What do you think it would be the appropriate approach in dealing with this?

Thanks!

A: 

There is a Linq to XML library that will get you more than enough functionality to get this done, I also would use a MVC Pattern and have the model plug in the correct node data to the Grids Datasource.

Gnostus
I will look into the Linq library, didn't know about that, thank you!
zenify
+1  A: 

Personally I dislike data grids as UI tools. I prefer the conventional ListView in Detail mode.

DataGrids should be used if you want to enable mass inputing of data - it should not be used for read-only purposes unless you are using a powerful 3rd party grid. (Like Infragistics which provides great functionality but is not free).

I assume the view you want is a Summary-Detail sort of view, where you display a summary of the elements in the tree and their details on the grid once each node is clicked. As Gnostus suggested - you should use the MVC design pattern.

If you can focus your question a bit more - I'm sure you can get more detailed answers.


Added:

So first let me suggest a bit of lite reading - I found in wikipedia this item about the MVC design pattern. It also offers a few .NET frameworks that specialize with MVC - I'm not familiar with any of them so I cannot comment on them. As with any OO project - I suggest you create an Object Model of your elements. Example: Building --> floor --> room.
As for the UI (i.e. the View), DataGrid input validations can be a pain - from the sound of it you don't need a grid's abilities - and would rather display the room's properties using a list view and have a separate dialog for adding new rows to the table.

RonK
Thank you for your answers!I should have been more explicit. It should work like this: Nodes have only organizational purpose (ex: floor number, room). To each node corresponds a table with some columns (ex: number of power consumers in that location). The table is editable, the user can add a new row for each consumer.I am new to C# so pointing me to a good direction would be greatly appreciated.
zenify