Asp. NET in ImageButton Picture button control Use _ Basic application

Source: Internet
Author: User

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");
}
}

Related Article

Contact Us

The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion; products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the content of the page makes you feel confusing, please write us an email, we will handle the problem within 5 days after receiving your email.

If you find any instances of plagiarism from the community, please send an email to: info-contact@alibabacloud.com and provide relevant evidence. A staff member will contact you within 5 working days.

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.