Go Back   TechArena Community > Software > Software Development
Become a Member!
Forgot your username/password?
Tags Active Topics RSS Search Mark Forums Read

Reply
 
Thread Tools Search this Thread
  #1  
Old 08-05-2009
Member
 
Join Date: May 2008
Posts: 95
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?
Reply With Quote
  #2  
Old 08-05-2009
Member
 
Join Date: May 2008
Posts: 2,008
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.
Reply With Quote
  #3  
Old 08-05-2009
Member
 
Join Date: May 2008
Posts: 95
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.
Reply With Quote
  #4  
Old 08-05-2009
XSI XSI is offline
Member
 
Join Date: May 2008
Posts: 271
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.
Reply With Quote
Reply

  TechArena Community > Software > Software Development
Tags: , ,



Thread Tools Search this Thread
Search this Thread:

Advanced Search


Similar Threads for: "Nested DataTable for GridView"
Thread Thread Starter Forum Replies Last Post
Ado.Net: Reorder columns in a DataTable Sergio 1 Software Development 3 29-12-2010 02:45 AM
Confused over DataTable, DataView and DataGrid Lawford Software Development 5 12-02-2010 03:34 AM
How to sort a datatable Udayachal Software Development 6 23-01-2010 01:23 PM
Exporting datatable to excel with ADO.net Sanket07 Software Development 2 03-02-2009 05:52 PM
How can i export datatable to excel Leena Software Development 3 30-01-2009 11:45 PM


All times are GMT +5.5. The time now is 06:01 AM.