Milton
Milton

Reputation: 171

Multiple If condtion in gridview itemtemplate

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" %>

Upvotes: 0

Views: 1779

Answers (1)

Amit Singh
Amit Singh

Reputation: 8109

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" %>

Upvotes: 4

Related Questions