Click here to Skip to main content
15,904,822 members
Home / Discussions / C#
   

C#

 
QuestionGridview1_rowdatabound event Pin
Andrew Woodward7-Jan-10 6:47
Andrew Woodward7-Jan-10 6:47 
AnswerRe: Gridview1_rowdatabound event Pin
Saksida Bojan7-Jan-10 8:25
Saksida Bojan7-Jan-10 8:25 
AnswerRe: Gridview1_rowdatabound event Pin
OriginalGriff7-Jan-10 8:25
mveOriginalGriff7-Jan-10 8:25 
GeneralRe: Gridview1_rowdatabound event Pin
Andrew Woodward7-Jan-10 9:26
Andrew Woodward7-Jan-10 9:26 
GeneralRe: Gridview1_rowdatabound event Pin
OriginalGriff7-Jan-10 9:47
mveOriginalGriff7-Jan-10 9:47 
GeneralRe: Gridview1_rowdatabound event Pin
Andrew Woodward7-Jan-10 9:57
Andrew Woodward7-Jan-10 9:57 
GeneralRe: Gridview1_rowdatabound event Pin
OriginalGriff7-Jan-10 10:14
mveOriginalGriff7-Jan-10 10:14 
GeneralRe: Gridview1_rowdatabound event Pin
Andrew Woodward7-Jan-10 10:26
Andrew Woodward7-Jan-10 10:26 
I have been doing some checking and the problem was that the word 'row' had a small 'r'.
I changed this to capital 'R' to give 'Row' and it works. Well almost.

If the value of 'difference' is equal to 2.5 it displays the correct image (Average.png)
If the value is anything else it displays 'Good.png'.

I've changed the code and took out the 'switch...case' and just used the 'if...else' statement but I still get the same result.

I bet your fed up with this one now.
This is my whole code just in case you can see anything wrong.

protected void GridView1_RowDataBound(object sender, GridViewRowEventArgs e)
    {
        DataRowView myDataRowView = (DataRowView)e.Row.DataItem;
        if (e.Row.RowType == DataControlRowType.DataRow)
        {
            if (Convert.ToSingle(myDataRowView["Difference"])>2.5)
                {
                    ((Image)e.Row.FindControl("ImageRating")).ImageUrl = "~/Images/Bad.png";
                }
            if (Convert.ToSingle(myDataRowView["Difference"]) == 2.5)
                {
                    ((Image)e.Row.FindControl("ImageRating")).ImageUrl = "~/Images/Average.png";
                }
            else
                {
                    ((Image)e.Row.FindControl("ImageRating")).ImageUrl = "~/Images/Good.png";
                }
    }
}


Its as if the '>2.5' is not working and it goes to the else statement if the value is not equal to 2.5

Andy
GeneralRe: Gridview1_rowdatabound event Pin
OriginalGriff7-Jan-10 10:33
mveOriginalGriff7-Jan-10 10:33 
GeneralRe: Gridview1_rowdatabound event Pin
Andrew Woodward7-Jan-10 10:39
Andrew Woodward7-Jan-10 10:39 
GeneralRe: Gridview1_rowdatabound event Pin
OriginalGriff7-Jan-10 10:50
mveOriginalGriff7-Jan-10 10:50 
QuestionAre there anyone who know how to process cube via .net c# Pin
ImTheKiN7-Jan-10 6:37
ImTheKiN7-Jan-10 6:37 
AnswerRe: Are there anyone who know how to process cube via .net c# Pin
Alan Balkany8-Jan-10 4:44
Alan Balkany8-Jan-10 4:44 
QuestionInteractive 2D openGL Pin
Paul Harsent7-Jan-10 6:27
Paul Harsent7-Jan-10 6:27 
QuestionApp.config with custom section and custom elements collection inside Pin
xkrja7-Jan-10 4:30
xkrja7-Jan-10 4:30 
Questionfind week num of first week in year [modified] Pin
Maddie from Dartford7-Jan-10 4:09
Maddie from Dartford7-Jan-10 4:09 
AnswerRe: find week num of first week in year Pin
dan!sh 7-Jan-10 4:21
professional dan!sh 7-Jan-10 4:21 
GeneralRe: find week num of first week in year Pin
Maddie from Dartford7-Jan-10 4:30
Maddie from Dartford7-Jan-10 4:30 
GeneralRe: find week num of first week in year Pin
dan!sh 7-Jan-10 4:36
professional dan!sh 7-Jan-10 4:36 
GeneralRe: find week num of first week in year Pin
Maddie from Dartford7-Jan-10 4:47
Maddie from Dartford7-Jan-10 4:47 
GeneralRe: find week num of first week in year Pin
dan!sh 7-Jan-10 4:53
professional dan!sh 7-Jan-10 4:53 
GeneralRe: find week num of first week in year [modified] Pin
dojohansen8-Jan-10 1:15
dojohansen8-Jan-10 1:15 
GeneralRe: find week num of first week in year Pin
OriginalGriff7-Jan-10 8:32
mveOriginalGriff7-Jan-10 8:32 
GeneralRe: find week num of first week in year Pin
dojohansen8-Jan-10 1:21
dojohansen8-Jan-10 1:21 
AnswerRe: find week num of first week in year Pin
Richard MacCutchan7-Jan-10 4:44
mveRichard MacCutchan7-Jan-10 4:44 

General General    News News    Suggestion Suggestion    Question Question    Bug Bug    Answer Answer    Joke Joke    Praise Praise    Rant Rant    Admin Admin   

Use Ctrl+Left/Right to switch messages, Ctrl+Up/Down to switch threads, Ctrl+Shift+Left/Right to switch pages.