ylbtech-ASP.NET-Control-Basic:ImageButton(圖片按鈕)的使用 |
ASP.NET中 ImageButton(圖片按鈕)的使用。
1.A,運行效果返回頂部 |
ImageButton(圖片按鈕)
屬性 | 值 | 作用 |
PostBackUrl | url | 單擊時,指向的頁面 |
ToolTip | 提示語 | |
ImageUrl | 要呈現圖片的位置 |
1.B,源代碼返回頂部 |
/ImageButton.aspx
View Code

<%@ 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"> <html xmlns="http://www.w3.org/1999/xhtml"> <head runat="server"> <title></title> </head> <body> <form id="form1" runat="server"> <div> <h3> ImageButton(圖片按鈕)</h3> <table style="width: 100%;"> <tr> <td> 屬性 </td> <td> 值 </td> <td> 作用 </td> </tr> <tr> <td> PostBackUrl </td> <td> url </td> <td> 單擊時,指向的頁面 </td> </tr> <tr> <td> ToolTip </td> <td> 提示語 </td> <td> </td> </tr> <tr> <td> ImageUrl </td> <td> 要呈現圖片的位置 </td> <td> </td> </tr> <tr> </table> <hr /> <asp:ImageButton ID="ibtn" runat="server" Height="20px" ImageUrl="http://images.cnblogs.com/cnblogs_com/ylbtech/403178/o_sanyecao.jpg" ToolTip="前台指向" 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="后台指向" Width="118px" onclick="ibtn2_Click" /> <br /> </div> </form> </body> </html>
/ImageButton.aspx.cs
View Code

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) { //方法內可以做很多操作 //注冊,注冊成功,跳轉到主頁 Response.Redirect("~/DemoHTML.aspx"); } }
1.C,資源下載返回頂部 |
http://files.cnblogs.com/ylbtech/WebForm-BasicControl-HTML.rar
![]() |
作者:ylbtech 出處:http://ylbtech.cnblogs.com/ 本文版權歸作者和博客園共有,歡迎轉載,但未經作者同意必須保留此段聲明,且在文章頁面明顯位置給出原文連接,否則保留追究法律責任的權利。 |