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 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
This thread has been closed and replies have been disabled. Please start a new discussion. Similar topics
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...
|
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...
|
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...
|
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...
|
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...
|
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
...
|
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
...
|
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...
|
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...
|
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
|
by: nemocccc |
last post by:
hello, everyone, I want to develop a software for my android phone for daily needs, any suggestions?
|
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...
|
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,...
|
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...
|
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...
|
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...
|
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...
|
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,...
| |