Click here to Skip to main content
13,398,338 members (36,623 online)
Rate this:
Please Sign up or sign in to vote.
See more:
Dear Friends, Good Day to all of u.

am working on School Project.

I have a Student Database with Student Marks.

i have displayed this data in working fine.

I have Database Fields as

Name Class Section Result Percentage
Arun 10 A Pass 89
Kishore 10 A Fail 95
Sandeep 10 B Fail 29

So, My Requirement is whereever fail is displayed in Gridview it must change the background color of cell to red.

Please help me, How to do this ? ?

Posted 6-Oct-12 0:30am
Rate this: bad
Please Sign up or sign in to vote.

Solution 1


You can change the gridview's cell backcolor in ondatabound event of the gridview.

Go through the links[^]

change cell color of GRIDVIEW based on system date[^]
Ubaid ur Rahman IT 6-Oct-12 5:38am
Ya i know in Databound event.

But Please tell me, WhereEver I find FAIL in Total Gridview it must change the cell background to Red.

Please help.
VijayChauhan123 6-Oct-12 5:45am
please find the links
Rate this: bad
Please Sign up or sign in to vote.

Solution 2


You need to check if the value is less then the passing marks in OnRowDataBound[^] event of the gridview. And to change the color of that cell you can simply use

args.Row.Cells[columnindex].BackColor = Your Color;

Hope it helps you,

This content, along with any associated source code and files, is licensed under The Code Project Open License (CPOL)

  Print Answers RSS
Top Experts
Last 24hrsThis month

Advertise | Privacy |
Web03 | 2.8.180216.1 | Last Updated 6 Oct 2012
Copyright © CodeProject, 1999-2018
All Rights Reserved. Terms of Service
Layout: fixed | fluid

CodeProject, 503-250 Ferrand Drive Toronto Ontario, M3C 3G8 Canada +1 416-849-8900 x 100