Click here to Skip to main content
14,877,780 members
Please Sign up or sign in to vote.
0.00/5 (No votes)
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 ? ?



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.
Rockstar_ 6-Oct-12 5:45am
please find the links

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)

CodeProject, 20 Bay Street, 11th Floor Toronto, Ontario, Canada M5J 2N8 +1 (416) 849-8900