binding format

  • Thread starter Thread starter Keith G Hicks
  • Start date Start date
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
 
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
 
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
 
Back
Top