Latest web development tutorials

ASP.NET ImageButton 控件

Web Server Controls Web服務器控件

定義和用法

ImageButton 控件用於顯示可點擊的圖像。


屬性

属性 描述 .NET
CausesValidation 规定在 ImageButton 控件被点击时,是否验证页面。 1.0
CommandArgument 有关要执行的命令的附加信息。 1.0
CommandName 与 Command 事件相关的命令。 1.0
GenerateEmptyAlternateText 规定该控件是否创建空字符串作为替代文本。 2.0
OnClientClick 当图像被点击时要执行的函数的名称。 2.0
PostBackUrl 当 ImageButton 被点击时,从当前页面进行回传的目标页面的 URL。 2.0
runat 规定该控件是一个服务器控件。必须被设置为 "server"。 1.0
TagKey 1.0
ValidationGroup 当 ImageButton 回传服务器时,该 ImageButton 控件引起验证所针对的控件组。 2.0

註釋: Image控件的屬性也能夠用在ImageButton控件上。

Web 控件標準屬性

AccessKey, Attributes, BackColor, BorderColor, BorderStyle, BorderWidth, CssClass, Enabled, Font, EnableTheming, ForeColor, Height, IsEnabled, SkinID, Style, TabIndex, ToolTip, Width

如需完整描述,請訪問Web控件標準屬性

控件標準屬性

AppRelativeTemplateSourceDirectory, BindingContainer, ClientID, Controls, EnableTheming, EnableViewState, ID, NamingContainer, Page, Parent, Site, TemplateControl, TemplateSourceDirectory, UniqueID, Visible

如需完整描述,請訪問控件標準屬性


實例

ImageButton
在本例中,我們在.aspx 文件中聲明了一個ImageButton 控件和一個Label 控件。 在用戶點擊此圖像時,會執行subroutine 子例程。 這個子例程會把消息"Coordinates: " 以及單擊的x 和y 坐標發送到Label 控件。


Web Server Controls Web服務器控件