Nested DataTable for GridView
What I want to know is that whether we can nest two or more DataTable to use as DataSource for a GridView.
I have a GridView where I want to display the list of training areas of a company and for each field I want to see a list of all courses that belong to that particular area using a GridView.
The solution, according to me, is to create a DataTable that serves the fields and in each field I create a DataTable powered by the associated training.
Unfortunately this solution did not work?
Do you have ideas or any suggestions to achieve this?
Re: Nested DataTable for GridView
There is, indeed, no doubt that you might have not done well because that's how it should proceed.
This is a super simple case, you have 2 tables: Fields, Area in which each area corresponds to a field.
You have a dropdown list which contains the fields and in the GridView you will display the corresponding training.
Re: Nested DataTable for GridView
What I mean is that I want the two to coexist in a single GridView.
For example:
I would like to have a table that contains the list of fields and in each fields I would like to have a list of areas belonging.
Example graphically
------------------------------
If | SQL Server
| C#
-------------------------------
Finance | Accounting
| Financial Analysis
-------------------------------
as the table is a GridView and the case of training is also a grid view. The database and the relationships between tables are correct.
I hope I explained my problem.
Re: Nested DataTable for GridView
A hierarchical DataGrid control makes sense only if the data source is a DataSet object that contains relations between tables. For example, consider a DataSet with Customers and Orders tables with a DataRelation set between the two on the CustomerID column. As long as the DataGrid contains a button column, when you click it you could create a child view for the selected customer and bind the resulting DataView object to the child grid.
Because the new control (named NestedGrid) inherits from the DataGrid class, you can use it whenever a DataGrid object is appropriate. In general, when you derive a control from a base class there might be situations in which the derived control can't just replace the original due to its specific extensions and additions. In this column, I won't spend much time making the NestedGrid component backward compatible with the base DataGrid class.