I have a DataGridView that could possibly switch its display values from 2 different dataTables, the information within is really simple, its a fixed 20rows x 20cols table.
Each cell must contain an object, So when i select a cell i can display its extended properties like MaxValue, MinValue, TotalValues, and so on (not just the AVG value which is the one displayed in the cell itself)
I can easily do that by storing the object in the TAG property of each cell in the DataGrid, but the problem I am facing is that when I change the datasource of my DataGridView all that information is NOT stored in the underlying dataTable.
What would be the best approach to solve this?
Looking for best recomendations
As a reference, the object to be stored is custom object and can implement or have any number of properties/attributes as needed
I should also clarify that 1 different object is needed for each cell, not 1 object by row
What I have tried:
I believe I could use 2 different datagridView controls and switch between them but that seems dumb, as there is now 2 datatables but there could be more.
I also thought of storing the objects in an external arraylist (rowIndex/colIndex) and then just search for the object when needed, but again i would need N-arrays for each datatable and doesn't sound about right?