How To: Datagrid Date Column formatted if Null then "Active"?

J

JDP@Work

I have a datagrid dgUersList that is populated from the dataview dvSingleUser.

My business rules are that if there is a date in the End_Date column then the
user's account is "Disabled", and if null then "Active".

I populate a checkbox option on a details panel with this logic.

HOWEVER, I would like either a similar D or A to be in the column in the
datagrid, not the date.

Should I, Could I either update the dataview (dvSingleUser)?

TIA

JeffP.....
 
S

Scott Mitchell [MVP]

JDP@Work said:
I have a datagrid dgUersList that is populated from the dataview dvSingleUser.

My business rules are that if there is a date in the End_Date column then the
user's account is "Disabled", and if null then "Active".

I populate a checkbox option on a details panel with this logic.

HOWEVER, I would like either a similar D or A to be in the column in the
datagrid, not the date.

The simplest solution, IMO, is to use a "helper function." Essentially
you use a TemplateColumn that calls a method in your code section,
passing in the date field. The method, which returns a string, would
return "A" or "D" based on your business rules.

There's a FAQ that illustrates this over at:
http://datawebcontrols.com/faqs/CustomizingAppearance/CustomizeColumnValue.shtml

Happy Programming!

--

Scott Mitchell
(e-mail address removed)
http://www.4GuysFromRolla.com

* When you think ASP.NET, think 4GuysFromRolla.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

No members online now.

Forum statistics

Threads
473,754
Messages
2,569,527
Members
45,000
Latest member
MurrayKeync

Latest Threads

Top