how to change html image src by c# -
<img src ="~/usercontrols/vote/images/arrow up.png" id = "vote-up-off" runat = "server" alt ="vote up" class="voteupimage" style="height: 45px; width: 44px"/>
here want change src of image condition like
if ( a==4) { src url shuld ...... } else { src url should be... }
first need give id
name can used variable:
<img src="~/usercontrols/vote/images/arrow up.png" id="voteupoff" runat="server" alt ="vote up" class="voteupimage" style="height: 45px; width: 44px" />
and in code behind use variable:
if (somecondition) { voteupoff.attributes["src"] = resolveurl("~/usercontrols/foo.png"); }
Comments
Post a Comment