ImageButton plainly, is a can display the picture of the button, the Use and button is basically consistent, nothing more than click to trigger events, only more than the button show more rich.
First, common ImageButton properties
Property |
Description |
ImageUrl |
The path of the image to display in the ImageButton control. |
ToolTip |
The text of the hint. |
AlternateText |
The text to display when the image cannot be displayed. |
Second, ImageButton Example Demo
Front Code imagebutton.aspx
Copy Code code as follows:
<%@ Page language= "C #" autoeventwireup= "true" codefile= "ImageButton.aspx.cs" inherits= "Webcontrols_imagebutton"% >
<! DOCTYPE HTML PUBLIC "-//W3C//DTD XHTML 1.0 transitional//en" "Http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd ">
<title></title>
<body>
<form id= "Form1" runat= "Server" >
<div>
<asp:imagebutton id= "ibtn" runat= "Server" height= "20px" imageurl= "Http://images.cnblogs.com/cnblogs_com/ylbtech" /403178/o_sanyecao.jpg "
tooltip= "Foreground point" width= "118px"/>
<br/>
<br/>
<asp:imagebutton id= "IBTN2" runat= "Server" height= "20px" imageurl= "http://images.cnblogs.com/cnblogs_com/" Ylbtech/403178/o_sanyecao.jpg "
tooltip= "Background point" width= "118px" onclick= "Ibtn2_click"/>
</div>
</form>
</body>
Background Code ImageButton.aspx.cs
Copy Code code as follows:
Using System;
Using System.Collections.Generic;
Using System.Web;
Using System.Web.UI;
Using System.Web.UI.WebControls;
public partial class WebControls_ImageButton:System.Web.UI.Page
{
protected void Page_Load (object sender, EventArgs e)
{
}
protected void Ibtn2_click (object sender, ImageClickEventArgs e)
{
You can do a lot of things within a method
Registration, registration success, jump to the home page
Response.Redirect ("~/demohtml.aspx");
}
}