NEWBIE - "Stoplight-like" Indicators in a DataGrid

R

RockNRoll

Greetings,

I have a datagrid that contains a list of invoice numbers, invoice date, and
invoice amount. All of this is pulled from a single table in my database.

I have a separate table that contains a list of invoice numbers and how much
payment we've received on those invoices.

I would like to have a column in my invoice datagrid that displays a green
"stoplight" indicator if the invoice is fully paid, yellow if it is
partially paid, and red if it has not been paid yet.

If the "stoplight" indicators are not possible, is there simply a way to get
that invoice payment information on my datagrid without creating a separate
datagrid (because then users would be looking in two locations for invoice
status)? Thank you for your help,

-Dave
 
D

Dave

Hi Dave,

I don't know if this you can use this, but I'm using vb.net, and did
something similar with this event handler:

Public Sub DataGrid1_ItemDataBound(ByVal sender As System.Object, ByVal e As
System.Web.UI.WebControls.DataGridItemEventArgs) Handles
DataGrid1.ItemDataBound

If e.Item.Cells(DataColumns.ColorCode).Text = "Green" Then

e.Item.Cells(DataColumns.ActionStatus).BackColor = Color.FromName("00ff00")

ElseIf e.Item.Cells(DataColumns.ColorCode).Text = "Amber" Then

e.Item.Cells(DataColumns.ActionStatus).BackColor = Color.FromName("ffff00")

ElseIf e.Item.Cells(DataColumns.ColorCode).Text = "Red" Then

e.Item.Cells(DataColumns.ActionStatus).BackColor = Color.FromName("ff0000")

Else

e.Item.Cells(DataColumns.ActionStatus).BackColor =
System.Drawing.Color.FromName("#e38a00")

End If

End Sub

It works fine for me. You would have to adjust the "If" conditions, of
course. I have a post on this thread myself concerning this routine.

Dave
 

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

No members online now.

Forum statistics

Threads
473,755
Messages
2,569,536
Members
45,007
Latest member
obedient dusk

Latest Threads

Top