ASP.Net How do I call a code behind method from an image
30-Jan-1414 Leave a comment
Following was html
<a href="CatalogueByList.aspx?VehicleTypeID=3" target="_self"> <img id="CatalogueCVImage" style="border-style: none; height: 94px; width: 172px; margin: 20px;" alt="Automotive Catalogue" src="Resources/ebc-catcommercial-button.jpg" /> </a>
Following is code behind call to a method from an image
<asp:ImageButton runat="server" id="CatalogueCar" ImageUrl="Resources/home-auto.jpg" AlternateText="Automotive Catalogue" CssClass="myImage" style="border-style:none; height: 94px; width: 172px;margin: 20px" OnClick="OpenCatalogueAutomotive" />
Then code behind as:
Protected Sub OpenCatalogueAutomotive(ByVal sender As Object, ByVal e As EventArgs) ViewState("VehicleTypeID") = 1 Response.Redirect("CatalogueByList.aspx?VehicleTypeID=1") End Sub
End