473,385 Members | 1,341 Online
Bytes | Software Development & Data Engineering Community
Post Job

Home Posts Topics Members FAQ

Join Bytes to post your question to a community of 473,385 software developers and data experts.

Datagrid Custom GridTableStyle??

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

Nov 15 '05 #1
2 1292
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
"Darryn Ross" <da****@datawave.com.au> wrote in message
news:OH**************@tk2msftngp13.phx.gbl...
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) ;

Nov 15 '05 #2
Yeah i am doing that.. the data gets bound after the styles are created and set to the datagrid.
"Dmitriy Lapshin [C# / .NET MVP]" <x-****@no-spam-please.hotpop.com> wrote in message news:e$*************@TK2MSFTNGP10.phx.gbl...
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
"Darryn Ross" <da****@datawave.com.au> wrote in message news:OH**************@tk2msftngp13.phx.gbl...
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) ;

Nov 15 '05 #3

This thread has been closed and replies have been disabled. Please start a new discussion.

Similar topics

1
by: Will | last post by:
Hi all, I need to know how to manually set the header name of a column in a datagrid. Everytime i retieve records from a database, the coloum header of the datagrid defaults to the column...
1
by: Jim Ptak via .NET 247 | last post by:
I am desperate for help. I am at a loss. I have a dataset with 4columns in it. The first column is an actual column from adatabase table. The last three columns are hard codded values of0. I am using...
1
by: Vagabond Software | last post by:
I am creating a custom datagrid based, in part, from someone else's code. The author declared a derived datagrid class in a windows form, then declared a derived ColumnStyle class, in the same form,...
1
by: Darryn Ross | last post by:
Hi, I am trying to display a long integer value from my access table in a Datagrid with a custom style applied to it and the value is not coming through correct?? database value = 0.00000 %...
3
by: Serdge Kooleman | last post by:
hello i'm able to display data in datagrid. how to change the column with, header etc? i'm trying to add TableStyles but it is not changing anything... my query: select id, dictionary from...
24
by: Mike L | last post by:
This is for a Win form, in C# 2005. I want to load a datagrid, make some columns width 0, and then clean out the record I added. I get the error message, ""Index was out of range. Must be...
2
by: fripper | last post by:
After a good bit of urging from folks in this newsgroup I have begun to become familiar with the VB .Net DataGrid control as a replacement for one my favorite VB6 controls ... the FlexGrid. In any...
4
by: tshad | last post by:
I have a dataGrid that I filled with files from my directory. I am using VS 2003 and Windows Forms. ************************************************************ Dim dirInfo As DirectoryInfo =...
0
by: tshad | last post by:
On my VS 2003 Windows Forms page I am trying to reuse my DataTable dependant on the users preference. This is easy in Asp.net, but apparently not as easy here. If I do the following code, where...
0
by: Faith0G | last post by:
I am starting a new it consulting business and it's been a while since I setup a new website. Is wordpress still the best web based software for hosting a 5 page website? The webpages will be...
0
isladogs
by: isladogs | last post by:
The next Access Europe User Group meeting will be on Wednesday 3 Apr 2024 starting at 18:00 UK time (6PM UTC+1) and finishing by 19:30 (7.30PM). In this session, we are pleased to welcome former...
0
by: taylorcarr | last post by:
A Canon printer is a smart device known for being advanced, efficient, and reliable. It is designed for home, office, and hybrid workspace use and can also be used for a variety of purposes. However,...
0
by: Charles Arthur | last post by:
How do i turn on java script on a villaon, callus and itel keypad mobile phone
0
by: aa123db | last post by:
Variable and constants Use var or let for variables and const fror constants. Var foo ='bar'; Let foo ='bar';const baz ='bar'; Functions function $name$ ($parameters$) { } ...
0
by: ryjfgjl | last post by:
In our work, we often receive Excel tables with data in the same format. If we want to analyze these data, it can be difficult to analyze them because the data is spread across multiple Excel files...
0
BarryA
by: BarryA | last post by:
What are the essential steps and strategies outlined in the Data Structures and Algorithms (DSA) roadmap for aspiring data scientists? How can individuals effectively utilize this roadmap to progress...
1
by: nemocccc | last post by:
hello, everyone, I want to develop a software for my android phone for daily needs, any suggestions?
1
by: Sonnysonu | last post by:
This is the data of csv file 1 2 3 1 2 3 1 2 3 1 2 3 2 3 2 3 3 the lengths should be different i have to store the data by column-wise with in the specific length. suppose the i have to...

By using Bytes.com and it's services, you agree to our Privacy Policy and Terms of Use.

To disable or enable advertisements and analytics tracking please visit the manage ads & tracking page.