The Image Button control perform similiar to the button control. You use an image button when you want your button to look different than the plain rectangular button. Any image can be a button! Below are examples of two image buttons. Each image button has an action to display a message in a label control (text feedback) when the image is clicked.
<asp:ImageButton ID="ImageButton2" runat="server" BackColor="Blue" BorderColor="Silver" BorderStyle="Solid" BorderWidth="2px" ForeColor="#FFC0FF" ImageAlign="Middle" ImageUrl="~/images/CANDY/bazooka.jpg" ToolTip="Click this image button to see what happens." /> <asp:Label ID="lblResults0" runat="server" style="font-size:18px;" Text="I like bubble gum." Width="220px"> <asp:Label>
Protected Sub ImageButton1_Click(ByVal sender As Object, ByVal e As System.Web.UI.ImageClickEventArgs) Handles ImageButton1.Click lblResults.Text = "Don't step in bubble gum. It is messy!" lblResults.Visible = True End Sub
You can also Postback to another page in the site.