I am using below code in gridview to show the status of the product. I have three status in gridview. I got the error "The name 'eval' does not exist in the current context"

<%# ((string)eval("fld_status") == "0") ? "~/images/arrow_yes.png" : ((string)eval("fld_status") == "1") ? "~/images/edit_msg.png" : "~/images/arrow_down.png" %>
有帮助吗?

解决方案

C# is case sensitive language...so both eval and Eval is different...and the method for binding is Eval not eval..so you can try like this

<%#  ((string)Eval("fld_status") == "0") ? "~/images/arrow_yes.png" : ((string)Eval("fld_status") == "1") ? "~/images/edit_msg.png" : "~/images/arrow_down.png" %>
许可以下: CC-BY-SA归因
不隶属于 StackOverflow
scroll top