I have a gridview which binds to a sql database.
I need to add an image to the gridview on condition of the column "Difference".
If the value of "Difference" is less than 2.5 then Good.jpg is displayed in a column called Rating. If the value of "Difference" is equal to 2.5 then Average.jpg should be displayed and if the value of "Difference" is greater than 2.5 then Bad.jpg should be displayed.
The data type of "Difference" is float.
So far I have converted the column "Rating" to a template and added
Code is:
SelectCommand="SELECT Code, Title, '£' + CONVERT (varchar(12), CONVERT (money, Target), 1) AS Target, '£' + CONVERT (varchar(12), CONVERT (money, Actual), 1) AS Actual, Rating, Difference FROM ScoreFinance"> |
I am using C# in the code behind.
Any help is gratefully received.
Andy
Akhilesh PathakPosted Jan 5, 2010, 10:16 PM
You can do this in item databound event of gridview , check the value of column and depending upon it u can set value of other column.