Solved

Changing the backcolor of a entire row in DataGrid

Posted on 2004-10-16
7
179 Views
Last Modified: 2010-04-15
Hello,
I have a Datagrid and create TableStyle and ColumnStyle for it. I want to change the backcolor of a entire row if the specific column of that row have one of my values.

ColA    ColB    ColC    ColD
1        A         a        Y
2        B         b        R
3        C         c         R
4        D         d        W
5        E         e         Y
6        F         f          W

I want to change the color of **entire** rows 1,5 to yellow.

I searched the EE and Net for it. But what I find is changing the color of a column not entire row.

Thanks for your help,
-FA
0
Comment
Question by:Farzad Akbarnejad
7 Comments
 
LVL 4

Expert Comment

by:Farshid-Zaker
ID: 12331616
You can change row colors using following code. Put this code after filling your grid. (It should be in your page_load) Remember that first rows index is zero.

dataGrid.Items[0].Style["BACKGROUND-COLOR"] = "yellow";
dataGrid.Items[4].Style["BACKGROUND-COLOR"] = "yellow";

Farshid
0
 
LVL 14

Author Comment

by:Farzad Akbarnejad
ID: 12332180
Farshid,
my Data Grid hasn't Items member. Maybe it was in Web Controls. I am using System.Windows.Form. I am developing Windows Application.

Thanks
-FA
0
 
LVL 69

Expert Comment

by:Éric Moreau
ID: 12332535
0
Is Your Active Directory as Secure as You Think?

More than 75% of all records are compromised because of the loss or theft of a privileged credential. Experts have been exploring Active Directory infrastructure to identify key threats and establish best practices for keeping data safe. Attend this month’s webinar to learn more.

 
LVL 14

Author Comment

by:Farzad Akbarnejad
ID: 12333021
Hello,
emoreau,
I visited your link before that I found it in EE solutions. It is about changing a cell not entire row.
I want to change the color of entire row.

I found the following link that its downloadable sample code is very valuable.
I solved my problem by helping of it.

http://msdn.microsoft.com/library/default.asp?url=/library/en-us/dnwinforms/html/wnf_CustDataGrid.asp

I want to close this question with Points Refund. Any Suggestion?

Thanks
-FA
0
 
LVL 69

Expert Comment

by:Éric Moreau
ID: 12333235
You have to ask a 0-point question into the community support topic
0
 

Accepted Solution

by:
RomMod earned 0 total points
ID: 12374079
The question has been PAQ'd and the 500 points have been refunded.
RomMod
Community Support Moderator
0

Featured Post

Is Your Active Directory as Secure as You Think?

More than 75% of all records are compromised because of the loss or theft of a privileged credential. Experts have been exploring Active Directory infrastructure to identify key threats and establish best practices for keeping data safe. Attend this month’s webinar to learn more.

Question has a verified solution.

If you are experiencing a similar issue, please ask a related question

Extention Methods in C# 3.0 by Ivo Stoykov C# 3.0 offers extension methods. They allow extending existing classes without changing the class's source code or relying on inheritance. These are static methods invoked as instance method. This…
Introduction                                                 Was the var keyword really only brought out to shorten your syntax? Or have the VB language guys got their way in C#? What type of variable is it? All will be revealed.   Also called…
This Micro Tutorial hows how you can integrate  Mac OSX to a Windows Active Directory Domain. Apple has made it easy to allow users to bind their macs to a windows domain with relative ease. The following video show how to bind OSX Mavericks to …
Internet Business Fax to Email Made Easy - With eFax Corporate (http://www.enterprise.efax.com), you'll receive a dedicated online fax number, which is used the same way as a typical analog fax number. You'll receive secure faxes in your email, fr…

895 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question

Need Help in Real-Time?

Connect with top rated Experts

11 Experts available now in Live!

Get 1:1 Help Now