G
Guest
Hello,
I have a dataset populated using an XML file. The schema has hierarchical
components. Let's say <a><b></b></a>.
I have created a datagrid and I have assigned a datastyle and then
gridcolumnstyle for all columns at the parent level.
I have created a datastyle for every child level and I have assigned also
gridcolumn styles to the components.
When I run the program, I have the grid displayed and the + symbol next to
my rows. When I expand this symbol, I have the name of the child table.
However, when I clicked on this name, I have this exception raised:
System.InvalidOperationException: The '' DataGridColumnStyle cannot be used
because it is not associated with a Property or Column in the DataSource.
I have a big red cross in the datagrid, and one element from this child
table displayed.
I have this code for the datagrid:
--
this.dataGrid.AlternatingBackColor = System.Drawing.Color.LightBlue;
this.dataGrid.DataMember = "";
this.dataGrid.DataSource = this.datasetTestCases.automated_test_case;
this.dataGrid.HeaderForeColor = System.Drawing.SystemColors.ControlText;
this.dataGrid.Location = new System.Drawing.Point(5, 65);
this.dataGrid.Name = "dataGrid";
this.dataGrid.PreferredColumnWidth = 80;
this.dataGrid.Size = new System.Drawing.Size(685, 330);
this.dataGrid.TabIndex = 2;
this.dataGrid.TableStyles.AddRange(new
System.Windows.Forms.DataGridTableStyle[] {
this.DataGridTableStyleMain,
this.dataGridTableStyleXCS,
this.dataGridTableStyleDB,
this.dataGridTableStyleOpt});
--
The dataGridTableStyleXCS, dataGridTableStyleDB, dataGridTableStyleOpt are
for every child table.
Here is the definition of one of them:
--
this.dataGridTableStyleXCS.AlternatingBackColor =
System.Drawing.SystemColors.ControlText;
this.dataGridTableStyleXCS.DataGrid = this.dataGrid;
this.dataGridTableStyleXCS.GridColumnStyles.AddRange(new
System.Windows.Forms.DataGridColumnStyle[] {
this.dataGridTextBoxColumnXCS1,
this.dataGridTextBoxColumnXCS2,
this.dataGridTextBoxColumnXCS3});
this.dataGridTableStyleXCS.HeaderForeColor =
System.Drawing.SystemColors.ControlText;
this.dataGridTableStyleXCS.MappingName = "automated_test_case_xcs";
this.dataGridTableStyleXCS.ReadOnly = true;
--
The mapping name correspond to the name of the child table, therefore I do
not understand what's going on.
Moreover, everything was fine before I assigned datagridstyles.
Thank you for your help.
I have a dataset populated using an XML file. The schema has hierarchical
components. Let's say <a><b></b></a>.
I have created a datagrid and I have assigned a datastyle and then
gridcolumnstyle for all columns at the parent level.
I have created a datastyle for every child level and I have assigned also
gridcolumn styles to the components.
When I run the program, I have the grid displayed and the + symbol next to
my rows. When I expand this symbol, I have the name of the child table.
However, when I clicked on this name, I have this exception raised:
System.InvalidOperationException: The '' DataGridColumnStyle cannot be used
because it is not associated with a Property or Column in the DataSource.
I have a big red cross in the datagrid, and one element from this child
table displayed.
I have this code for the datagrid:
--
this.dataGrid.AlternatingBackColor = System.Drawing.Color.LightBlue;
this.dataGrid.DataMember = "";
this.dataGrid.DataSource = this.datasetTestCases.automated_test_case;
this.dataGrid.HeaderForeColor = System.Drawing.SystemColors.ControlText;
this.dataGrid.Location = new System.Drawing.Point(5, 65);
this.dataGrid.Name = "dataGrid";
this.dataGrid.PreferredColumnWidth = 80;
this.dataGrid.Size = new System.Drawing.Size(685, 330);
this.dataGrid.TabIndex = 2;
this.dataGrid.TableStyles.AddRange(new
System.Windows.Forms.DataGridTableStyle[] {
this.DataGridTableStyleMain,
this.dataGridTableStyleXCS,
this.dataGridTableStyleDB,
this.dataGridTableStyleOpt});
--
The dataGridTableStyleXCS, dataGridTableStyleDB, dataGridTableStyleOpt are
for every child table.
Here is the definition of one of them:
--
this.dataGridTableStyleXCS.AlternatingBackColor =
System.Drawing.SystemColors.ControlText;
this.dataGridTableStyleXCS.DataGrid = this.dataGrid;
this.dataGridTableStyleXCS.GridColumnStyles.AddRange(new
System.Windows.Forms.DataGridColumnStyle[] {
this.dataGridTextBoxColumnXCS1,
this.dataGridTextBoxColumnXCS2,
this.dataGridTextBoxColumnXCS3});
this.dataGridTableStyleXCS.HeaderForeColor =
System.Drawing.SystemColors.ControlText;
this.dataGridTableStyleXCS.MappingName = "automated_test_case_xcs";
this.dataGridTableStyleXCS.ReadOnly = true;
--
The mapping name correspond to the name of the child table, therefore I do
not understand what's going on.
Moreover, everything was fine before I assigned datagridstyles.
Thank you for your help.