Small trick to hide HTML element
In this post I’m going to only show a simple trick how to hide an image by using XPath expression and by not adding “server side” code into codebehind or inside a server side script block. I got this simple idea from a post I recently answered on the ASP.Net forum. Maybe some other may find this useful. <img runat="server" visible='<%# (XPath("@value") == "35" ) %>' src='<%# "images/" + XPath("@img") + ".gif" %>'> The XPath expression for the @value attribute will return true if the value is 35, if not it will return false. The visible attribute that is added to the img element, can only hide an element if it’s turned into a html server control. That is done by adding the runat attribute.
0 comments:
Post a Comment
Thanks for the Comments.