473,657 Members | 2,411 Online
Bytes | Software Development & Data Engineering Community
+ Post

Home Posts Topics Members FAQ

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 6645
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
DataGridColumnS tyle and then handle the rendering of the background color
based on the value.

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

"Erald Kulk" <er***@delta-travel.nl> wrote in message
news:d9******** *************** ***@posting.goo gle.com...
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************* *@exisconsultin g.com

"Erald Kulk" <an*******@devd ex.com> wrote in message
news:eD******** ******@tk2msftn gp13.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 DataGridColumnS tyle 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 expressioncolum n. 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
7840
by: amber | last post by:
Hello, How can I trigger an event, when a value (cell) in my datagrid changes? TIA, amber
3
2439
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 ListItemType.Item, ListItemType.AlternatingItem If e.Item.Cells(7).Text = String.Empty Then e.Item.Cells(7).Text = "hello" End If End Select
4
10693
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 make sure entry is valid? Thanks, Rog
5
1585
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 while I may have overlooked it, I have not found an answer. I now am using the CurrentCellChanged event, and this is satisfactory IF the user moves off of the cell before closing the form. An obvious alternative would be to check for changes before...
3
2123
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 TableCell; DataGridItem item = cell.Parent as DataGridItem; int index = item.ItemIndex;
2
2250
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? "Curtis" <curtsfakeguy@hotmail.com> wrote in message
3
3291
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 the field should only be showing one or the other (date or time). Even on the back end of the database where the column properties are, I have chosen the smallest date/time formats. When the aspx page runs, it shows the date and time (ie:in a...
2
2939
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 method. What I am trying to accomplish is to detect if a value has changed in any cell so that if a user closes the form without saving first, I want to prompt to save changes. I don't want to prompt if there were no changes.
0
1190
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 changed then as a result of this change in 3rd column's cell (it is textbox) value is inserted from another table in database named Product.
0
8399
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, people are often confused as to whether an ONU can Work As a Router. In this blog post, we’ll explore What is ONU, What Is Router, ONU & Router’s main usage, and What is the difference between ONU and Router. Let’s take a closer look ! Part I. Meaning of...
0
8732
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 tapestry of website design and digital marketing. It's not merely about having a website; it's about crafting an immersive digital experience that captivates audiences and drives business growth. The Art of Business Website Design Your website is...
1
8504
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 Update option using the Control Panel or Settings app; it automatically checks for updates and installs any it finds, whether you like it or not. For most users, this new feature is actually very convenient. If you want to control the update process,...
0
8606
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 protocol has its own unique characteristics and advantages, but as a user who is planning to build a smart home system, I am a bit confused by the choice of these technologies. I'm particularly interested in Zigbee because I've heard it does some...
1
6169
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 presenter, Adolph Dupré who will be discussing some powerful techniques for using class modules. He will explain when you may want to use classes instead of User Defined Types (UDT). For example, to manage the data in unbound forms. Adolph will...
0
4318
by: adsilva | last post by:
A Windows Forms form does not have the event Unload, like VB6. What one acts like?
1
2732
by: 6302768590 | last post by:
Hai team i want code for transfer the data from one system to another through IP address by using C# our system has to for every 5mins then we have to update the data what the data is updated we have to send another system
2
1959
muto222
by: muto222 | last post by:
How can i add a mobile payment intergratation into php mysql website.
2
1622
bsmnconsultancy
by: bsmnconsultancy | last post by:
In today's digital era, a well-designed website is crucial for businesses looking to succeed. Whether you're a small business owner or a large corporation in Toronto, having a strong online presence can significantly impact your brand's success. BSMN Consultancy, a leader in Website Development in Toronto offers valuable insights into creating effective websites that not only look great but also perform exceptionally well. In this comprehensive...

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.