ASP.NET.in.a.Nutshell.Second.Edition [Electronic resources]

G. andrew Duthie; matthew Macdonald

نسخه متنی -صفحه : 873/ 771
نمايش فراداده

ImageButtondisposable

System.Web.UI.WebControls (system.web.dll)class

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 : Image, System.Web.UI.IPostBackDataHandler, System.Web.UI. IPostBackEventHandler { // Public Constructors public

ImageButton ( ); // Public Instance Properties public bool

CausesValidation {set; get; } public string

CommandArgument {set; get; } public string

CommandName {set; get; } // Protected Instance Properties protected override HtmlTextWriterTag

TagKey {get; } // overrides WebControl // Protected Instance Methods protected override void

AddAttributesToRender (System.Web.UI.HtmlTextWriter

writer ); // overrides Image protected virtual void

OnClick (System.Web.UI.ImageClickEventArgs

e ); protected virtual void

OnCommand (CommandEventArgs

e ); protected override void

OnPreRender (EventArgs

e ); // overrides System.Web.UI.Control // Events public event ImageClickEventHandler

Click ; public event CommandEventHandler

Command ; }

Hierarchy

System.Object System.Web.UI.Control(System.ComponentModel.IComponent, System.IDisposable, System.Web.UI.IParserAccessor, System.Web.UI.IDataBindingsAccessor) WebControl(System.Web.UI.IAttributeAccessor) Image ImageButton(System.Web.UI.IPostBackDataHandler, System.Web.UI.IPostBackEventHandler)