Main Page

  Previous Section Next Section


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

This class represents a control that appears like a HyperLink control, but fires a Click and Command event like a Button control would. A good use of this control is to provide a hyperlink that navigates to another web page but allows you to perform some programmatic cleanup (for example, clearing session variables) before you redirect the user.

Like all button controls, the LinkButton class provides a CausesValidation property you can set to prevent page validation from occurring when the control is clicked. It also provides the standard CommandName and CommandArgument properties that allow you to specify additional information that will be sent to a Command event.

public class LinkButton : WebControl, System.Web.UI.IPostBackEventHandler {
// Public Constructors
   public LinkButton( );
// Public Instance Properties
   public bool CausesValidation{set; get; }
   public string CommandArgument{set; get; }
   public string CommandName{set; get; }
   public virtual string Text{set; get; }
// Protected Instance Methods
   protected override void AddAttributesToRender(                // overrides WebControl
 System.Web.UI.HtmlTextWriter writer);
   protected override void AddParsedSubObject(object obj);      // overrides System.Web.UI.Control
   protected override void LoadViewState(object savedState);    // overrides WebControl
   protected virtual void OnClick(EventArgs e);
   protected virtual void OnCommand(CommandEventArgs e);
   protected override void OnPreRender(EventArgs e);            // overrides System.Web.UI.Control
   protected override void RenderContents(System.Web.UI.HtmlTextWriter writer); // overrides WebControl
// Events
   public event EventHandler Click;
   public event CommandEventHandler Command;


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

      Previous Section Next Section