We use cookies to give you the best experience on our website. If you continue to browse, then you agree to our privacy policy and cookie policy.
Unfortunately, activation email could not send to your email. Please try again.

Cells Colors

Thread ID:

Created:

Updated:

Platform:

Replies:

8421 Nov 5,2003 09:43 AM Nov 5,2003 02:13 PM Windows Forms 4
loading
Tags: GridControl
Alex
Asked On November 5, 2003 09:43 AM

I have created a GridDataBound and it's data source i chose a DataTable . now , each time I add something to the DataTable it also appears on the GridDataBound . my problem is like this , I wanna change the background of one or more rows , or if that is not possible I wanna change cells colors . I tried changing the color of the cells like this : gridDataBound1 [ 1 , 1 ].BackColor = Color.Aqua but it won't change it ... why is that ? and how can I change a whole row or at least one cell . thanks for the help .

Administrator [Syncfusion]
Replied On November 5, 2003 10:06 AM

There are a couple of KB articles that discuss how to do this. http://www.syncfusion.com/KB/Grid/Grid_c35c.asp#q560q http://www.syncfusion.com/KB/Grid/Grid_c35c.asp#q561q

Alex
Replied On November 5, 2003 10:29 AM

but how do I call this function , it is an event and not a function . i want a function that recevies a primary key in the DataTable and changes the row color in the GridDataBound . please help me ...

Administrator [Syncfusion]
Replied On November 5, 2003 11:14 AM

You cannot call a function and change the color of a row in a GridDataBoundGrid. The reason is that there no properties stored on a row basis in a GridDataBoundGrid. Instead, you must listened for the PrepareViewStyleInfo event. There, if e.RowIndex and e.ColIndex point to a cell that you want to color, you should set e.Style.BackColor to the desired color. (This way, there is never any color saved for a particular cell or row. It is always provided on demand through this event). You can use grid.Binder.NameToColIndex to find out the column index for your key column. Attached is a little sample that colors any row whose 'primary key' value is divisible by 4.

Alex
Replied On November 5, 2003 02:13 PM

well , ok thanks I will try it tommorow at work and see if it works .

CONFIRMATION

This post will be permanently deleted. Are you sure you want to continue?

Sorry, An error occured while processing your request. Please try again later.

You are using an outdated version of Internet Explorer that may not display all features of this and other websites. Upgrade to Internet Explorer 8 or newer for a better experience.

;