Re: conditional in GridView Eval binding?

Tech Tip: Click here to run a free scan for Windows Errors and optimize PC performance



Your code is wrong. You're mixing server and javascript in the same line.

Try do this in GridView_RowDataBound event

get the data bind for LocationType

do your friendly string

show it in the correspondent cell


Dabbler wrote:
I'm trying to replace a user code in data column with user friendly text for a GridView ItemTemplate as in:

Text='<%# Eval("LocationType")%> == "P" ? "Pickup" : "DropOff"'

However the value always displays "DropOff" as if the binding doesn't return any P's but I know there are Ps in the rows I'm testing with.

LocationType is defined as char(1) in the table.

Any suggestion why this isn't working?

Thanks.
.