Click here to Skip to main content
15,885,278 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 Gridview...it 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 ? ?

Thanks.
Posted

hi,

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

Go through the links

http://highoncoding.com/Articles/180_Changing_GridView_Column_Color.aspx[^]

change cell color of GRIDVIEW based on system date[^]
 
Share this answer
 
v2
Comments
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
Hi,

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,
Thanks
 
Share this answer
 

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