ad <ad@wfes.tcc.ed u.tw> wrote:
I convert the field to a template column and then use a tmeplate expression
like this:
<%# (DataBinder.Eva l(Container, "DataItem.SexID "))=="1" ? "Male":"Female" %>
Why the value always equal Female
DataBinder.Eval (object, string) is an expression of type object, so
you're performing a reference identity comparison against the string
literal "1". If you use
"1".Equals(Data Binder.Eval (Container, DataItem.SexID" ))
?"Male":"Female "
you may well find it works. Or not, depending on whether the evaluation
actually returns a string or not...
--
Jon Skeet - <sk***@pobox.co m>
http://www.pobox.com/~skeet
If replying to the group, please do not mail me too