473,394 Members | 1,715 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,394 software developers and data experts.

Re: GridView DataRowBound Question

when do you clear PriceChange which is a running total?

-- bruce (sqlwork.com)

pvong wrote:
Doing this in VB.Net

I have this in DataRowBound and the below is my code. All I want it to do
is if it the result of the math is positive, make the text green. Negative
= red and 0 do nothing. The attach jpg shows my result. For some reason,
it's random. Does anyone have any idea?

If DataBinder.Eval(e.Row.DataItem, "PriceChange") IsNot DBNull.Value Then

'-------

PriceChange += Convert.ToDecimal(DataBinder.Eval(e.Row.DataItem,
"pricechange"))

'-------

If PriceChange < 0 Then

e.Row.Cells(12).ForeColor = Drawing.Color.DarkRed

Else

If PriceChange 0 Then

e.Row.Cells(12).ForeColor = Drawing.Color.Green

End If

End If

End If
Nov 11 '08 #1
1 1301
Stupid me. Thanks. Didn't see that + there.

It's fixed now.

Thanks!

"bruce barker" <no****@nospam.comwrote in message
news:ut**************@TK2MSFTNGP02.phx.gbl...
when do you clear PriceChange which is a running total?

-- bruce (sqlwork.com)

pvong wrote:
>Doing this in VB.Net

I have this in DataRowBound and the below is my code. All I want it to
do is if it the result of the math is positive, make the text green.
Negative = red and 0 do nothing. The attach jpg shows my result. For
some reason, it's random. Does anyone have any idea?

If DataBinder.Eval(e.Row.DataItem, "PriceChange") IsNot DBNull.Value Then

'-------

PriceChange += Convert.ToDecimal(DataBinder.Eval(e.Row.DataItem,
"pricechange"))

'-------

If PriceChange < 0 Then

e.Row.Cells(12).ForeColor = Drawing.Color.DarkRed

Else

If PriceChange 0 Then

e.Row.Cells(12).ForeColor = Drawing.Color.Green

End If

End If

End If

Nov 11 '08 #2

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

Similar topics

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...
4
by: Nalaka | last post by:
Hi, I have two questions about gridViews. 1. How can I intercept the row/column values at loading to change values? 2. After I update a row (using default update functionality), how can I...
7
by: | last post by:
Hello, Does anyone have an idea on how I can filter the data in the gridview control that was returned by an sql query? I have a gridview that works fine when I populate it with data. Now I...
0
by: hammad.awan_nospam | last post by:
Hello, I am using ASP.NET 2.0. What I have done is nested a gridview inside another column of a gridview using a template data field column declaritively in my web form. Inside this child...
1
by: Giovanni | last post by:
Dear Friends/Gurus, I have exhausted myself and have yet no solution to the following: I have an ASP.NET 2.0 Survey type application. On a page, I have placed a GridView which is bound to an...
1
by: Barry L. Camp | last post by:
Hi all, Wondering if someone can help with a nagging problem I am having using a GridView and an ObjectDataSource. I have a simple situation where I am trying to delete a row from a table, but...
4
by: pvong | last post by:
Doing this in VB.NET with VS2008. I have a simple GridView with two columns. Column1 Header is called "Reason" and the rows contain a Label called "ReasonL". Column2 header is called Add/Edit...
0
by: =?Utf-8?B?R3JpZFZpZXcgTmV3Ymll?= | last post by:
I have a business requirement stating that when the Location Type is "C" the user should not be able to update the StoreNumber. So, when the user clicks the "edit" button in the GridView for a...
2
by: pvong | last post by:
Doing this in VB.NET I have a gridview RowDataBound. I want to do a test on each row column (12). Some of the rows have NULL value. This is the error message I'm getting. Object cannot be...
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
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: 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
by: Hystou | last post by:
There are some requirements for setting up RAID: 1. The motherboard and BIOS support RAID configuration. 2. The motherboard has 2 or more available SATA protocol SSD/HDD slots (including MSATA, M.2...
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,...
0
tracyyun
by: tracyyun | last post by:
Dear forum friends, With the development of smart home technology, a variety of wireless communication protocols have appeared on the market, such as Zigbee, Z-Wave, Wi-Fi, Bluetooth, etc. Each...

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.