473,387 Members | 1,540 Online
Bytes | Software Development & Data Engineering Community
Post Job

Home Posts Topics Members FAQ

Join Bytes to post your question to a community of 473,387 software developers and data experts.

Gridview DataRowBond Template Question

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!
Nov 11 '08 #1
1 1144
"pvong" <phillip*at*yahoo*dot*comwrote in message
news:O9**************@TK2MSFTNGP05.phx.gbl...
I'm a newbie, but I'm learning so please be patient with me.
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?
What you need to do is set a breakpoint on the first line of the above code
and step through it. You'll soon discover where the problem lies...
--
Mark Rae
ASP.NET MVP
http://www.markrae.net

Nov 11 '08 #2

This thread has been closed and replies have been disabled. Please start a new discussion.

Similar topics

3
by: washoetech | last post by:
I have a gridview control. In this grid view there is a column for the price of an item. Some of the prices have a dollar sign in front of it and some dont. How do I get rid of the dollar sign...
6
by: Nalaka | last post by:
Hi, I have a gridView (grid1), which as a templateColumn. In the template column, I have put in a gridView (grid2) and a ObjectDataSource (objectDataSource2). Question is... How to I pass the...
3
by: NateDawg | last post by:
I'm reposting this. I'm kinda in a bind untill i get this figured out, so if anyone has some input it would sure help me out. Ok, I’ve noticed a few gridview problems floating around the forum....
4
by: Chris Davoli | last post by:
I've got two questions on how to do things in the new GridView. I'm used to the DataGrid in ASP 1.1, so I need the equavalent in ASP 2.0 Gridview. 1.) What is the equavalent for Item Command...
2
by: cartmann | last post by:
Hi, I have a gridview with a template column. In the template column i have two commandbuttons. When clicking the buttons I enter the cmd_click event - but how do I read in which row the button...
1
by: Paulo | last post by:
Hi, I have a aspx with a a FormView on left wich opens insert template as default containing all the TextsBox, Combos, etc, and on right a GridView listing the stored itens (ID column key)... When...
3
by: =?Utf-8?B?UGF1bA==?= | last post by:
Hi I have a gridview with several template columns and a few command button columns, column 1 and 2 are dropdown boxes, column 3 is a checkbox and column 4 is a text box, followed by command button...
4
by: Craig Buchanan | last post by:
I dynamically add data-bound templates to a gridview in my ascx control. while this works correctly when the gridview is databound to the datatable, i'm having issues on postback. i would like...
1
by: renuami | last post by:
Hello friends please advise....... I am building an application for Survey. For this i have GridView with two Template fields. The first Template has Label (To display question text) and...
0
by: Charles Arthur | last post by:
How do i turn on java script on a villaon, callus and itel keypad mobile phone
0
by: ryjfgjl | last post by:
If we have dozens or hundreds of excel to import into the database, if we use the excel import function provided by database editors such as navicat, it will be extremely tedious and time-consuming...
0
by: ryjfgjl | last post by:
In our work, we often receive Excel tables with data in the same format. If we want to analyze these data, it can be difficult to analyze them because the data is spread across multiple Excel files...
0
by: emmanuelkatto | last post by:
Hi All, I am Emmanuel katto from Uganda. I want to ask what challenges you've faced while migrating a website to cloud. Please let me know. Thanks! Emmanuel
0
BarryA
by: BarryA | last post by:
What are the essential steps and strategies outlined in the Data Structures and Algorithms (DSA) roadmap for aspiring data scientists? How can individuals effectively utilize this roadmap to progress...
1
by: nemocccc | last post by:
hello, everyone, I want to develop a software for my android phone for daily needs, any suggestions?
1
by: Sonnysonu | last post by:
This is the data of csv file 1 2 3 1 2 3 1 2 3 1 2 3 2 3 2 3 3 the lengths should be different i have to store the data by column-wise with in the specific length. suppose the i have to...
0
marktang
by: marktang | last post by:
ONU (Optical Network Unit) is one of the key components for providing high-speed Internet services. Its primary function is to act as an endpoint device located at the user's premises. However,...
0
Oralloy
by: Oralloy | last post by:
Hello folks, I am unable to find appropriate documentation on the type promotion of bit-fields when using the generalised comparison operator "<=>". The problem is that using the GNU compilers,...

By using Bytes.com and it's services, you agree to our Privacy Policy and Terms of Use.

To disable or enable advertisements and analytics tracking please visit the manage ads & tracking page.