Search code examples
.netwindows-mobilecompact-framework

DataGridTableStyle not working on .NET Compact framework


I am developing a Windows Form application on a Windows Mobile 6 device and I cannot get the datagrid to format correctly. When I use the code below there are no columns displayed, it is either ignoring my code or it is incorrect but there are no errors generated.

DataGridTableStyle dgTableStyle = new DataGridTableStyle();
dgTableStyle.MappingName = tempDt.TableName;

DataGridTextBoxColumn dgSty_name = new DataGridTextBoxColumn();
dgSty_name.HeaderText = "name";
dgSty_name.MappingName = "sty_name";
dgTableStyle.GridColumnStyles.Add(dgSty_name);

dataGrid1.TableStyles.Add(dgTableStyle);
dataGrid1.DataSource = tempDt;

The datatable I am binding (tempDt) has about 6 columns in it, one of them is called sty_name.

Any help greatly appreciated as this is driving me mad!

thanks

Mike


Solution

  • Solved it! sty_name needs to be in capitals!