Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations bkrike on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

Quick formatting question

Status
Not open for further replies.

quinnipiac0807

Programmer
Oct 25, 2004
38
US
Quick formatting question. What is the easiest way to change the format of a boolean variable in a datagrid on an asp webpage. Would it be to do it in the SQL procedure, or is there a way to put it right in the c# code?
 
Usually, I'd just stick in something like:

Code:
<%# ((byte)DataBinder.Eval(Container,"DataItem.boolCol") == 1) ? "true string" : "false string" ) %>

There may be some syntax errors there - I didn't test it, but that should give you an idea.

-----------------------------------------------
"The night sky over the planet Krikkit is the least interesting sight in the entire universe."
-Hitch Hiker's Guide To The Galaxy
 
I would use a case statement inside the SQL sp

SELECT
Firstname,
LastName,
CASE IsActive
WHEN '0' THEN 'No'
WHEN '1' THEN 'Yes'
END
FROM UserInfo

Regards,
NatGreen
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top