Solved

Changing the backcolor of a entire row in DataGrid

Posted on 2004-10-16
7
181 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
Free Tool: Site Down Detector

Helpful to verify reports of your own downtime, or to double check a downed website you are trying to access.

One of a set of tools we are providing to everyone as a way of saying thank you for being a part of the community.

 
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

Free Tool: Path Explorer

An intuitive utility to help find the CSS path to UI elements on a webpage. These paths are used frequently in a variety of front-end development and QA automation tasks.

One of a set of tools we're offering as a way of saying thank you for being a part of the community.

Question has a verified solution.

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

This article aims to explain the working of CircularLogArchiver. This tool was designed to solve the buildup of log file in cases where systems do not support circular logging or where circular logging is not enabled
The article shows the basic steps of integrating an HTML theme template into an ASP.NET MVC project
This video shows how to use Hyena, from SystemTools Software, to bulk import 100 user accounts from an external text file. View in 1080p for best video quality.
Although Jacob Bernoulli (1654-1705) has been credited as the creator of "Binomial Distribution Table", Gottfried Leibniz (1646-1716) did his dissertation on the subject in 1666; Leibniz you may recall is the co-inventor of "Calculus" and beat Isaac…

809 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