Having this piece of code:
<asp:LinkButton runat="server" OnClick="ChangeImage_Click" >
<img src="imagethatshouldbechanged" />
</asp:LinkButton>
And this:
protected void ChangeImage_Click(object sender, EventArgs e)
{
//Code here
}
How do I change the image when I click the linkbutton.
You need to make img
runat="server"
and assign id to it to access inChangeImage_Click
or use asp:Image instead ofimg
HTML
Code bahind