I have C# application that fills a GridView with data from a DataTable object, which is filled from parsing a text file. Now i want to do a master-detail scheme, where the master GridView shows an identifying column from the DataTable for all rows, and the detail GridView shows all the columns for that row.
All the examples I’m finding seem to require a SqlDataSource control (to provide the filtering mechanism), which then requires a connection to a database. I can’t find how to provide this information when using only a DataTable data source. What provider would I use, and what would the connection string look like?
Thanks in Advance for any help.
You already have your
DataSource(unless the data will change when you click aGridViewRow), so all you need is to get something like a Key from your currentGridView, create a newDataSourceby loading data from yourDataTablewith the selected key in yourGridViewand bind it to your newGridView. I could also suggest that you take a look to theDetailsViewcontrol which is designed to do in fact what you are trying to accomplish here (master-details scheme).Good luck my friend.