Brett,
I don't think that you need to set the MappingName property on the table
style. The mapping name is for when you are binding to a specific type, not
for the name of the table, I believe.
From the documentation for the MappingName property:
To bind the DataGrid to a strongly typed array of objects, the object type
must contain public properties. To create a DataGridTableStyle that displays
the array, set the DataGridTableStyle.MappingName property to typename where
typename is replaced by the name of the object type. Also note that the
MappingName property is case-sensitive; the type name must be matched
exactly. See the MappingName property for an example.
Hope this helps.
--
- Nicholas Paldino [.NET/C# MVP]
-
mv*@spam.guard.caspershouse.com
"Brett Romero" <ac*****@cygen.com> wrote in message
news:11**********************@g49g2000cwa.googlegr oups.com...
I have the following DataGridTableStyle:
DataGridTableStyle gridTableStyle = new DataGridTableStyle();
gridTableStyle.MappingName = "myStyle";
DataGridTextBoxColumn dgsc = new DataGridTextBoxColumn();
dgsc.MappingName = "FirstName";
dgsc.HeaderText = "First Name";
dgsc.Width = 30;
dgsc.TextBox.Enabled = false;
gridTableStyle.GridColumnStyles.Add(dgsc);
mygrid.TableStyles.Add(gridTableStyle);
mygrid.DataSource = someDataView;
I can see in the grid for the assigned table that the firstname column
is "FirstName". That should match. Instead, every row from the
DataSet shows in the grid. Shouldn't only the firstname column
display? What am I doing wrong?
Thanks,
Brett