barryr

barryr

  • NA
  • 10
  • 0

DataGridTableStyle problem

Mar 5 2005 3:40 PM
Hi I am trying to set the DataGridTableStyle of two datagrids, which display the data from two dataviews on the same table. the problem is that when I apply the new styles to each datagrid, formatting errors occur in the datagrids. Specifically when you click on rows of data in the one datagrid, the rows are highlighted in the other datagrid, even if a filter is applied to that datagrid, such that the rows are not visible. my code; DataGridTableStyle DVFanucErrorStyle = new DataGridTableStyle(); DataGridTableStyle DVFanucErrorStyle2 = new DataGridTableStyle(); foreach(DataColumn dc in dataViewFanucErrors.Table.Columns) DataGridTextBoxColumn textColumn = new DataGridTextBoxColumn(); DataGridTextBoxColumn textColumn2 = new DataGridTextBoxColumn(); textColumn.MappingName = dc.ColumnName; textColumn.HeaderText = dc.Caption; if(dc.ColumnName.ToString()== "Fanuc_ErrorID") { textColumn.HeaderText = "ID:"; textColumn.Width = 0; } //few more columns DVFanucErrorStyle.MappingName = dataViewFanucErrors.Table.TableName; DVFanucErrorStyle2.MappingName = dataViewFanucErrorsPicked.Table.TableName; dataGridErrorsNotPicked.TableStyles.Add(DVFanucErrorStyle); dataGridErrorsPicked.TableStyles.Add(DVFanucErrorStyle2); dataGridErrorsNotLogged.DataSource = dataViewFanucErrorsNotPicked; dataGridErrorsLogged.DataSource = dataViewFanucErrorsPicked; can't even get the IDE interface to work since the mapping property for the style collection does not even recognise the tables/views defined in my form I can understand that my two dataviews are views of the same table, but why should this screw up datagrid views of the same table? any help appreciated cheers Barry

Answers (2)