Datagrid Custom GridTableStyle??

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) ;
 
D

Dmitriy Lapshin [C# / .NET MVP]

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) ;
 
D

Darryn Ross

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) ;
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Top