473,404 Members | 2,114 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,404 software developers and data experts.

change fore color of single cell in a datagrid

L.S.

in a datagrid I would like the forecolor of a single cell. Because it
is a negative number. This cannot be done by changing the NumberFormat
property.
So how can I do this??

Erald
Nov 13 '05 #1
3 6636
Erald,

This is difficult with the current DataGrid. The reason is that
determining how to render contents on the grid is done on a per-column
basis. Because of this, you would have to create a class that derives from
DataGridColumnStyle and then handle the rendering of the background color
based on the value.

Hope this helps.
--
- Nicholas Paldino [.NET/C# MVP]
- ni**************@exisconsulting.com

"Erald Kulk" <er***@delta-travel.nl> wrote in message
news:d9**************************@posting.google.c om...
L.S.

in a datagrid I would like the forecolor of a single cell. Because it
is a negative number. This cannot be done by changing the NumberFormat
property.
So how can I do this??

Erald

Nov 13 '05 #2
Erald,

Honestly, I do think that it is the wrong way (the way they implemented
it). I think that there are third party controls out there which do a much
better job. One of the ones I like is the grid from Xceed software. You
can find more information about it at:

http://www.xceedsoft.com/products/GridNet/
--
- Nicholas Paldino [.NET/C# MVP]
- ni**************@exisconsulting.com

"Erald Kulk" <an*******@devdex.com> wrote in message
news:eD**************@tk2msftngp13.phx.gbl...


Nicholas Paldino,

thank you for your answer. I will have to figure out how to derive the
class correctly, but I think I'll manage.
Quite strang it is that complicated, but that's probably too
philosophical.

Erald Kulk

*** Sent via Developersdex http://www.developersdex.com ***
Don't just participate in USENET...get rewarded for it!

Nov 13 '05 #3
thank you for the advise. By extending the DataGridColumnStyle and
changing the overridden pain method I created the datagrid I intended
to have. New problem. This column has an expression to calculate its
values. But this generates an error when saving. cannot change the
readonly property of the expressioncolumn. or something like that. I
got the error in dutch.

anybody any idea?

Erald Kulk
Nov 13 '05 #4

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

Similar topics

8
by: amber | last post by:
Hello, How can I trigger an event, when a value (cell) in my datagrid changes? TIA, amber
3
by: Richard | last post by:
I'm trying to change a value of a cell based on another before the grid is displayed. I'm using the ItemDataBound event like this for a simple test: Select Case e.Item.ItemType Case...
4
by: Roger | last post by:
I have a datagrid and would like to know what even fires when a cell is changed? I want to know when the user changes a cell and moves to the next. I have some code that needs to be done to...
5
by: Earl | last post by:
I want to fire a database update off of a single change to a single cell in the datagrid. This apparently cannot be done using keypress, keyup, keydown, etc. I've read George Shepard's FAQ and...
3
by: John Smith | last post by:
I'm looking into this peace of code: protected void DropDown_SelectedIndexChanged(object sender, EventArgs e) { DropDownList list = (DropDownList)sender; TableCell cell = list.Parent as...
2
by: John Smith | last post by:
Will this line of the code: item.Cells.Text = "Some text..."; change only DataGrid visual value or it will also change value in the DataSource? How can I change value in DataSource? ...
3
by: Jim in Arizona | last post by:
I have a gridview that's being populated from an access db query. The problem I'm having is that the date/time fields in access that are populating the gridview are showing both date and time, when...
2
by: =?Utf-8?B?TWlrZQ==?= | last post by:
Greetings, I am trying to find out how to do something that on the surface seems like it should be very simple to do. I have a datagrid with a datatable bound to it using the SetDataBinding...
0
by: joinzulfi | last post by:
Dear fellows! I have designed a form having SaleMasterTable and SaleDetailTable. SaleDetailTable is Bounded with DataGrid. Now I want that if in2nd Column's cell (it is combobox) value is...
0
by: Charles Arthur | last post by:
How do i turn on java script on a villaon, callus and itel keypad mobile phone
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
Oralloy
by: Oralloy | last post by:
Hello folks, I am unable to find appropriate documentation on the type promotion of bit-fields when using the generalised comparison operator "<=>". The problem is that using the GNU compilers,...
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
isladogs
by: isladogs | last post by:
The next Access Europe User Group meeting will be on Wednesday 1 May 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 a new...

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.