conditional formating on Datagrid control

H

Harley

i have a databound datagrid control. one of the bound columns displays a
date.
i need to display it in red if it is 2 or less days from the current date,
and leave it with the default color if not.
any idea?
 
J

John

Add a column to the underlying datatable, call it displayDate, then before
binding, iterate through the rows of the table checking the value in the
column RealDate and based on that set the value in displayDate to be

"[font color=red (or black for normal
dates)>"+RealDate.ToString()+"[/font>";

Then, set the RealDate bound column invisible, and the displaydate column
visible.

"[" used instead of left carat above to prevent some mail readers from
going nuts.

John
http://mallsocket.com
 

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,767
Messages
2,569,572
Members
45,045
Latest member
DRCM

Latest Threads

Top