Solved

Changing the backcolor of a entire row in DataGrid

Posted on 2004-10-16
7
180 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 70

Expert Comment

by:Éric Moreau
ID: 12332535
0
Netscaler Common Configuration How To guides

If you use NetScaler you will want to see these guides. The NetScaler How To Guides show administrators how to get NetScaler up and configured by providing instructions for common scenarios and some not so common ones.

 
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 70

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

Netscaler Common Configuration How To guides

If you use NetScaler you will want to see these guides. The NetScaler How To Guides show administrators how to get NetScaler up and configured by providing instructions for common scenarios and some not so common ones.

Question has a verified solution.

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

Introduction This article series is supposed to shed some light on the use of IDisposable and objects that inherit from it. In essence, a more apt title for this article would be: using (IDisposable) {}. I’m just not sure how many people would ge…
Calculating holidays and working days is a function that is often needed yet it is not one found within the Framework. This article presents one approach to building a working-day calculator for use in .NET.
Email security requires an ever evolving service that stays up to date with counter-evolving threats. The Email Laundry perform Research and Development to ensure their email security service evolves faster than cyber criminals. We apply our Threat…
The Email Laundry PDF encryption service allows companies to send confidential encrypted  emails to anybody. The PDF document can also contain attachments that are embedded in the encrypted PDF. The password is randomly generated by The Email Laundr…

778 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