Gridview DataRowBond Template Question

P

pvong

Doing this in VB.Net

I'm a newbie, but I'm learning so please be patient with me. I have a
Gridview where the last column(15) is a template column that I've got a
LinkButton in the Item field that is databound. All I want to do in the
RowDataBound is to see if the number is a positive or a negative. If it's
>0, then green. If it's <0, then red. What am I doing wrong?

If DataBinder.Eval(e.Row.DataItem, "UnrealizedGains") IsNot DBNull.Value
Then
UGains = Convert.ToDecimal(DataBinder.Eval(e.Row.DataItem,
"UnrealizedGains"))
If UGains < 0 Then
e.Row.Cells(15).ForeColor = Drawing.Color.DarkRed
Else
If UGains > 0 Then
e.Row.Cells(15).ForeColor = Drawing.Color.Green
End If
End If
End If

Am I not calling the LinkButton somehow? I'm going to guess that I can not
use cells(15) for this.

Thanks!
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Members online

Forum statistics

Threads
473,756
Messages
2,569,535
Members
45,008
Latest member
obedient dusk

Latest Threads

Top