Datagrid Custom GridTableStyle??

  • Thread starter Thread starter Darryn Ross
  • Start date Start date
D

Darryn Ross

Hi....

I am adding my own table and column style to my datagrid, but when i view the form the field width isn' what i set it too in my code?

A snippet of my code is as follows...

DataGridTableStyle TSTblStyle = new DataGridTableStyle() ;
TSTblStyle.MappingName = "tbl";



DataGridColumnStyle TCChartCode = new DataGridTextBoxColumn() ;

TCCode.MappingName = "Code";

TCCode.HeaderText = "Code";

TCCode.Width = 11 ;

TSTblStyle.GridColumnStyles.Add(TCChartCode) ;

dg.TableStyles.Add(TSTblStyle) ;
 
Hi,

Ensure you set up the styles before the data is bound to the grid.

--
Dmitriy Lapshin [C# / .NET MVP]
X-Unity Test Studio
http://www.x-unity.net/teststudio.aspx
Bring the power of unit testing to VS .NET IDE
Hi....

I am adding my own table and column style to my datagrid, but when i view
the form the field width isn' what i set it too in my code?

A snippet of my code is as follows...

DataGridTableStyle TSTblStyle = new DataGridTableStyle() ;
TSTblStyle.MappingName = "tbl";



DataGridColumnStyle TCChartCode = new DataGridTextBoxColumn() ;

TCCode.MappingName = "Code";

TCCode.HeaderText = "Code";

TCCode.Width = 11 ;

TSTblStyle.GridColumnStyles.Add(TCChartCode) ;

dg.TableStyles.Add(TSTblStyle) ;
 
Yeah i am doing that.. the data gets bound after the styles are created and set to the datagrid.
Hi,

Ensure you set up the styles before the data is bound to the grid.

--
Dmitriy Lapshin [C# / .NET MVP]
X-Unity Test Studio
http://www.x-unity.net/teststudio.aspx
Bring the power of unit testing to VS .NET IDE
Hi....

I am adding my own table and column style to my datagrid, but when i view the form the field width isn' what i set it too in my code?

A snippet of my code is as follows...

DataGridTableStyle TSTblStyle = new DataGridTableStyle() ;
TSTblStyle.MappingName = "tbl";



DataGridColumnStyle TCChartCode = new DataGridTextBoxColumn() ;

TCCode.MappingName = "Code";

TCCode.HeaderText = "Code";

TCCode.Width = 11 ;

TSTblStyle.GridColumnStyles.Add(TCChartCode) ;

dg.TableStyles.Add(TSTblStyle) ;
 
Back
Top