I’m using .NET webforms. I have a grid view that can use Eval(“Name”) in the markup and it works fine. However, I need to do some computations on it so in the code behind I made a method called FormatName(String name). I can use that in the markup and it works when I pass it a string but not when I when I try to use Eval(“Name”.
<%# Eval("Name") %> works
< %# FormatName("jim") %> works
I’m looking for something like this:
<%# FormatName(Eval("Name"))>%
That doesnt work but I figure there is something close.
<%# FormatName(Eval("Name").ToString())>%should work. Eval returns an object, not a string.Another option is the
EvalTextfunction, which evaluates the value as a string.