binding format

K

Keith G Hicks

I have a sql field called Status (which can be 1, 2, 3 or 4)

In a details view ItemTemplate I'd like the bound label to show "Open" for
1, "Closed" for 2, etc. I figure I can do this with the databinding string.

Bind("status", "<format stuff here>")

Not sure how to do that or if this is even the best way. What should I do?

Thanks,

Keith
 
K

Keith G Hicks

Well, I figured out I can do this:

IIF(Eval("Status")=1,"NOP", IIF(Eval("Status")=2, "Open",
IIF(Eval("Status")=3, "Win", IIF(Eval("Status")=4, "Closed", ""))))

Not sure if there's a better way but the above works. Open to suggestions
though.

Keith
 
L

lue

If you use VB.NET You can use "Choose" where the "status" is a variable
from 1 to 4
CStr(Choose("Status", "NOP", "Open", "Win", "Closed"))


Regards
 

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
474,184
Messages
2,570,975
Members
47,533
Latest member
medikillz39

Latest Threads

Top