Name

ImageButton

Synopsis

This class extends the Image class to provide an image control that can respond to button clicks. The ImageButton class provides both a Click and a Command event, which will fire when the image is clicked. Use the Command event and the CommandName property to specify additional information that will be provided to the event handler. This technique is sometimes used to allow the same event handler to respond to clicks from multiple ImageButton controls and determine what control fired the event.

By default, clicking an ImageButton control will cause page validation to occur. To change this behavior, set the CausesValidation property to False.

Public Class ImageButton : Inherits Image : Implements_
       System.Web.UI.IPostBackDataHandler,_
       System.Web.UI.IPostBackEventHandler
' Public Constructors
   Public Sub New() 
' Public Instance Properties
   Public Property CausesValidation As Boolean  
   Public Property CommandArgument As String  
   Public Property CommandName As String  
' Protected Instance Properties
   Overrides Protected Property TagKey As HtmlTextWriterTag  
' Protected Instance Methods
   Overrides Protected Sub AddAttributesToRender(
        ByVal writer As System.Web.UI.HtmlTextWriter) 
   Overridable Protected Sub OnClick(
        ByVal e As System.Web.UI.ImageClickEventArgs) 
   Overridable Protected Sub OnCommand(
        ByVal e As CommandEventArgs) 
   Overrides Protected Sub OnPreRender(ByVal e As EventArgs) 
' Events
   Public Event Click As ImageClickEventHandler  
   Public Event Command As CommandEventHandler ...

Get ASP.NET in a Nutshell now with the O’Reilly learning platform.

O’Reilly members experience books, live events, courses curated by job role, and more from O’Reilly and nearly 200 top publishers.