html - Why does Eval statement show the wrong image -


sql (active column of type bit):

id      question            active 1       weather today       1 

asp.net eval:

<img src='<%# eval("active") == "1" ? "images/active.png" : "images/inactive.png" %>' /> 

html:

<img src="images/inactive.png"> 

why inactive.png image showing , not active.

bit fields correspond boolean. need type conversion ensure right comparison done, eval outputs object. so:

(bool)eval("active") == true 

Comments

Popular posts from this blog

Failed to execute goal org.apache.maven.plugins:maven-surefire-plugin:2.12:test (default-test) on project.Error occurred in starting fork -

windows - Debug iNetMgr.exe unhandle exception System.Management.Automation.CmdletInvocationException -

configurationsection - activeMq-5.13.3 setup configurations for wildfly 10.0.0 -