473,396 Members | 1,871 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,396 software developers and data experts.

Datagrid Custom table/column style...

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 %
datagrid value = 0.00 %

How do i get my column style to display the details as they are in the
table???...

the columns in question are the % columns...

my code is as follows.....
string[] strHeaderText = new string[] {"Partner ID", "Partner Name",
"Current Year %", "Last Year %", "Two Years Ago %", "Three Years Ago %",
"Four Years Ago %"} ;

int[] iWidth = new int[] {70, 150, 95, 95, 95, 95, 95} ;

// Add a GridTableStyle and set the MappingName

// to the name of the DataTable.

DataGridTableStyle TSPartner = new DataGridTableStyle() ;

TSPartner.MappingName = "tblPartner" ;

DataTable dt = PartDs.Tables["tblPartner"] ;

// Add a GridColumnStyle and set the MappingName

// to the name of a DataColumn in the DataTable.

// Set the HeaderText and Width properties.

for(int i = 0; i < 7; i++) {

DataGridTextBoxColumn CColStyle = new DataGridTextBoxColumn() ;

CColStyle.MappingName = dt.Columns[i].ColumnName ;

CColStyle.HeaderText = strHeaderText[i] ;

CColStyle.Width = iWidth[i] ;

CColStyle.ReadOnly = (i == 0) ? true : false ;

if(i == 1) {

dt.Columns[i].DefaultValue = "" ;

}

else if(i > 1) {

dt.Columns[i].DefaultValue = 0 ;

CColStyle.Format = "P" ;

}

TSPartner.GridColumnStyles.Add(CColStyle) ;

CColStyle.Dispose() ;

}

TSPartner.AllowSorting = false ;

dgPartners.TableStyles.Add(TSPartner) ;

Regards

Darryn
Nov 16 '05 #1
1 1877
Not sure but try

CColStyle.Format = "##.#####";

Hopes This Helps
"Darryn Ross" <da****@datawave.com.au> wrote in message
news:#E**************@TK2MSFTNGP12.phx.gbl...
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 %
datagrid value = 0.00 %

How do i get my column style to display the details as they are in the
table???...

the columns in question are the % columns...

my code is as follows.....
string[] strHeaderText = new string[] {"Partner ID", "Partner Name",
"Current Year %", "Last Year %", "Two Years Ago %", "Three Years Ago %",
"Four Years Ago %"} ;

int[] iWidth = new int[] {70, 150, 95, 95, 95, 95, 95} ;

// Add a GridTableStyle and set the MappingName

// to the name of the DataTable.

DataGridTableStyle TSPartner = new DataGridTableStyle() ;

TSPartner.MappingName = "tblPartner" ;

DataTable dt = PartDs.Tables["tblPartner"] ;

// Add a GridColumnStyle and set the MappingName

// to the name of a DataColumn in the DataTable.

// Set the HeaderText and Width properties.

for(int i = 0; i < 7; i++) {

DataGridTextBoxColumn CColStyle = new DataGridTextBoxColumn() ;

CColStyle.MappingName = dt.Columns[i].ColumnName ;

CColStyle.HeaderText = strHeaderText[i] ;

CColStyle.Width = iWidth[i] ;

CColStyle.ReadOnly = (i == 0) ? true : false ;

if(i == 1) {

dt.Columns[i].DefaultValue = "" ;

}

else if(i > 1) {

dt.Columns[i].DefaultValue = 0 ;

CColStyle.Format = "P" ;

}

TSPartner.GridColumnStyles.Add(CColStyle) ;

CColStyle.Dispose() ;

}

TSPartner.AllowSorting = false ;

dgPartners.TableStyles.Add(TSPartner) ;

Regards

Darryn

Nov 16 '05 #2

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

Similar topics

8
by: Ashish Shridharan | last post by:
Hi All I have been trying to add a control to the header cell of a datagrid on my ASP.NET page. These controls are defined in the HTML as ASP.NET web controls. They are being added into the...
5
by: K | last post by:
I created a collection which is derived from ArrayList and implements IBindingList and ITypedList. Then I bound the DataSource of a data grid into the collection. It could show up the data but...
5
by: Brian Henry | last post by:
I have a messaging application that has a data grid with information like an email list would have (from, subject, time sent, size) but the subject could be very long in theory, and then it would...
6
by: Ron L | last post by:
I have a dataset whose source is a SQL 2k stored procedure that I am trying to display in a datagrid. This datasource has 4 columns that I am interested in here, a text column and 3 value columns...
6
by: Doug Bell | last post by:
Hi I have a datagrid with a combo box, I need to populate the combo with data dependant on the record value. eg for record 1, field Warehouse = 2R so combo would allow selection of locations...
4
by: Peter | last post by:
I am using ArrayDataView from the following link, my question is how do I apply column styles to this DataGrid that uses ArrayDataView instead of DataSet ...
3
by: Peter | last post by:
I am using ArrayDataView from the following link, my question is how do I apply column styles to this DataGrid that uses ArrayDataView instead of DataSet ...
2
by: Mike Baugh | last post by:
I am using visual studio 2005 to develop a form using c# I have 3 datagrids on one form. I can set the row color based on a certain value in a column. However this color applies to all 3...
2
by: cj | last post by:
I was looking over some of my 2003 code today (see below) that loads a foxpro table via oledb connection. I used a sub "autosizecolumns" I found on the web but I never quite understood why they...
0
by: emmanuelkatto | last post by:
Hi All, I am Emmanuel katto from Uganda. I want to ask what challenges you've faced while migrating a website to cloud. Please let me know. Thanks! Emmanuel
1
by: nemocccc | last post by:
hello, everyone, I want to develop a software for my android phone for daily needs, any suggestions?
0
by: Hystou | last post by:
There are some requirements for setting up RAID: 1. The motherboard and BIOS support RAID configuration. 2. The motherboard has 2 or more available SATA protocol SSD/HDD slots (including MSATA, M.2...
0
marktang
by: marktang | last post by:
ONU (Optical Network Unit) is one of the key components for providing high-speed Internet services. Its primary function is to act as an endpoint device located at the user's premises. However,...
0
by: Hystou | last post by:
Most computers default to English, but sometimes we require a different language, especially when relocating. Forgot to request a specific language before your computer shipped? No problem! You can...
0
jinu1996
by: jinu1996 | last post by:
In today's digital age, having a compelling online presence is paramount for businesses aiming to thrive in a competitive landscape. At the heart of this digital strategy lies an intricately woven...
0
by: Hystou | last post by:
Overview: Windows 11 and 10 have less user interface control over operating system update behaviour than previous versions of Windows. In Windows 11 and 10, there is no way to turn off the Windows...
0
tracyyun
by: tracyyun | last post by:
Dear forum friends, With the development of smart home technology, a variety of wireless communication protocols have appeared on the market, such as Zigbee, Z-Wave, Wi-Fi, Bluetooth, etc. Each...
0
agi2029
by: agi2029 | last post by:
Let's talk about the concept of autonomous AI software engineers and no-code agents. These AIs are designed to manage the entire lifecycle of a software development project—planning, coding, testing,...

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.