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
Post a Comment