I want to show the master / detail relationship using two datagridviews and a DataRelation in C #.
The relationship between the main and the detailed table is the identifier from the type string (and there is no way to change the identifier for entering an integer).
It seems that the DataGridView cannot update the detail view when changing a row in the main table.
Does anyone know if it is possible to get a master / part view using the row id, and if so, how? Or do I need to use an external DataGrid from another company?
UPDATE
Personally, I do not see the difference in using a string instead of an integer. The only thing I can think of is that the grid cannot handle the presentation of the main part using the row id relation.
Here is an example, please create a new VS 2008 project and copy the code. Change the connection string and datarelation:
using System; using System.Data; using System.Data.SqlClient; using System.Windows.Forms; public class Form1 : System.Windows.Forms.Form { private DataGridView masterDataGridView = new DataGridView(); private BindingSource masterBindingSource = new BindingSource(); private DataGridView detailsDataGridView = new DataGridView(); private BindingSource detailsBindingSource = new BindingSource(); [STAThreadAttribute()] public static void Main() { Application.Run(new Form1()); }
Daniel
source share