System.Web 1.0.5000.0 2.0.0.0 Gtk# is thread aware, but not thread safe; See the <link location="node:gtk-sharp/programming/threads">Gtk# Thread Programming</link> for details. System.Web.UI.WebControls.WebControl System.Web.UI.IPostBackEventHandler System.Web.UI.WebControls.IButtonControl System.Web.UI.ToolboxData("<{0}:LinkButton runat="server">LinkButton</{0}:LinkButton>") System.Web.UI.SupportsEventValidation System.Web.UI.ParseChildren(false) System.ComponentModel.Designer("System.Web.UI.Design.WebControls.LinkButtonDesigner, System.Design, Version=2.0.0.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a", "System.ComponentModel.Design.IDesigner") System.ComponentModel.DefaultProperty("Text") System.ComponentModel.DefaultEvent("Click") System.Web.UI.DataBindingHandler("System.Web.UI.Design.TextDataBindingHandler, System.Design, Version=2.0.0.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a") System.Web.UI.ControlBuilder(typeof(System.Web.UI.WebControls.LinkButtonControlBuilder))

In this topic:

Introduction

LinkButton Controls and Validation

Declarative Syntax

## Introduction

Use the control to create a hyperlink-style button on the Web page. The control has the same appearance as a control, but has the same functionality as a control. If you want to link to another Web page when the control is clicked, consider using the control.

The control renders JavaScript to the client browser. The client browser must have JavaScript enabled for this control to function properly. For more information on client script, see Client Script in ASP.NET Web Pages.

You can create either a Submit button or a Command button. A Submit button does not have a command name associated with it. The button simply posts the Web page back to the server. By default, a control is a Submit button. You can provide an event handler for the event to programmatically control the actions performed when the Submit button is clicked. On the other hand, a Command button has a command name associated with the button, such as Sort. Set the property to specify the command name. This allows you to create multiple controls on a Web page and programmatically determine which control is clicked. You can also use the property with a Command button to provide additional information about the command to perform, such as specifying ascending order. You can also provide an event handler for the event to programmatically control the action performed when the Command button is clicked.

This control can be used to display user input, which might include malicious client script. Text is not HTML encoded before it is displayed in the control. Check any information that is sent from a client for executable script, SQL statements, or other code before displaying it in your application. ASP.NET provides an input request validation feature to block script and HTML in user input. Validation server controls are also provided to assess user input. For more information, see [<topic://cpconASPNETSyntaxForValidationControls>].

## LinkButton Controls and Validation

By default, page validation is performed when a control is clicked. Page validation determines whether the input controls associated with a validation control on the page all pass the validation rules specified by the validation control. To prevent page validation from occurring, set the property to false.

## Declarative Syntax

`<asp:LinkButton AccessKey="string" BackColor="color name|#dddddd" BorderColor="color name|#dddddd" BorderStyle="NotSet|None|Dotted|Dashed|Solid|Double|Groove|Ridge| Inset|Outset" BorderWidth="size" CausesValidation="True|False" CommandArgument="string" CommandName="string" CssClass="string" Enabled="True|False" EnableTheming="True|False" EnableViewState="True|False" Font-Bold="True|False" Font-Italic="True|False" Font-Names="string" Font-Overline="True|False" Font-Size="string|Smaller|Larger|XX-Small|X-Small|Small|Medium| Large|X-Large|XX-Large" Font-Strikeout="True|False" Font-Underline="True|False" ForeColor="color name|#dddddd" Height="size" ID="string" OnClick="Click event handler" OnClientClick="string" OnCommand="Command event handler" OnDataBinding="DataBinding event handler" OnDisposed="Disposed event handler" OnInit="Init event handler" OnLoad="Load event handler" OnPreRender="PreRender event handler" OnUnload="Unload event handler" PostBackUrl="uri" runat="server" SkinID="string" Style="string" TabIndex="integer" Text="string" ToolTip="string" ValidationGroup="string" Visible="True|False" Width="size" />`

Displays a hyperlink-style button control on a Web page.

- Constructor

  Use this constructor to create and initialize a new instance of the control.

  Initializes a new instance of the class.

  1.0.5000.0
  2.0.0.0
- Method
  System.Void `` a To be added

  Adds the attributes of the control to the output stream for rendering on the client.

  1.0.5000.0
  2.0.0.0
- Method
  System.Void `` To be added

  Notifies the control that an element, either XML or HTML, was parsed, and adds the element to the control's object.

  An that represents the parsed element. 1.0.5000.0 2.0.0.0
- Property
  System.Boolean To be added: an object of type 'bool'

  By default, page validation is performed when a control is clicked. Page validation determines whether the input controls associated with a validation control on the page all pass the validation rules specified by the validation control.

  You can specify (or determine) whether validation is performed on both the client and the server when a control is clicked by using the property. To prevent validation from being performed, set the property to false.

  This property is commonly set to false for a Reset or Clear button to prevent validation from being performed when the button is clicked.

  When the value of the property is set to true, you can also use the property to specify the name of the validation group for which the control causes validation.

  This property cannot be set by themes or style sheet themes. For more information, see and ASP.NET Themes Overview.

  Gets or sets a value indicating whether validation is performed when the control is clicked.

  1.0.5000.0
  2.0.0.0
  System.Web.UI.Themeable(false)
  System.ComponentModel.DefaultValue(true)
- Event
  System.EventHandler

  The event is raised when the control is clicked. This event is commonly used when no command name is associated with the control, as in the case of a Submit button.

  For more information about handling events, see [<topic://cpconEventsOverview>].

  Occurs when the control is clicked.

  1.0.5000.0
  2.0.0.0
- Event
  System.Web.UI.WebControls.CommandEventHandler

  The event is raised when the control is clicked. This event is commonly used when a command name, such as Sort, is associated with the control. This allows you to create multiple controls on a Web page and programmatically determine which control is clicked.

  The event is raised through the control hierarchy in the form of the BubbleEvent.

  For more information about handling events, see [<topic://cpconEventsOverview>].

  Occurs when the control is clicked.

  1.0.5000.0
  2.0.0.0
- Property
  System.String To be added: an object of type 'string'

  Use the property to specify an argument that complements the property.

  The property is typically only used when the property is set.

  The property complements the property by allowing you to provide any additional information about the command to perform. For example, you can set the property to Sort and set the property to Ascending to specify a command to sort in ascending order.

  This property cannot be set by themes or style sheet themes. For more information, see and ASP.NET Themes Overview.

  Gets or sets an optional argument passed to the event handler along with the associated property.

  1.0.5000.0
  2.0.0.0
  System.Web.UI.Themeable(false)
  System.ComponentModel.DefaultValue("")
  System.ComponentModel.Bindable(true)
- Property
  System.String To be added: an object of type 'string'

  When you have multiple controls on a Web page, use the property to specify or determine the command name associated with the control clicked. You can set the property with any string that identifies the command to perform. You can then programmatically determine the command name of the control and perform the appropriate actions.

  Additional information about the command, such as an Ascending sort order, can be specified by using the property.

  This property cannot be set by themes or style sheet themes. For more information, see and ASP.NET Themes Overview.

  Gets or sets the command name associated with the control. This value is passed to the event handler along with the property.

  1.0.5000.0
  2.0.0.0
  System.Web.UI.Themeable(false)
  System.ComponentModel.DefaultValue("")
- Method
  2.0.0.0
  System.Web.UI.PostBackOptions

  The method creates a object that represents the control's postback behavior. The object is then typically passed to the method, which is used to obtain a reference to a client-side script function that, when invoked, causes the server to post back to the page.

  This method is used primarily by control developers when extending the class.

  Creates a object that represents the control's postback behavior.

  A that represents the control's postback behavior.

- Method
  System.Void `` To be added To be added The saved state to retrieve. 1.0.5000.0 2.0.0.0
- Method
  System.Void ``

  The event is raised when the control is clicked. This event is commonly used when no command name is associated with the control, as in the case of a Submit button.

  Raising an event invokes the event handler through a delegate. For more information, see [<topic://cpconProvidingEventFunctionality>].

  The method also allows derived classes to handle the event without attaching a delegate. This is the preferred technique for handling the event in a derived class.

  Raises the event of the control.

  A that contains the event data. 1.0.5000.0 2.0.0.0
- Property
  2.0.0.0
  System.Web.UI.Themeable(false)
  System.ComponentModel.DefaultValue("")
  System.String To be added.

  Use the property to specify additional client-side script that executes when the control's event is raised. The script that you specify for this property is rendered in the control's OnClick attribute in addition to the control's predefined client-side script.

  This property cannot be set by themes or style sheet themes. For more information, see and ASP.NET Themes Overview.

  Gets or sets the client-side script that executes when a control's event is raised

- Method
  System.Void ``

  The event is raised when the control is clicked. This event is commonly used when a command name, such as Sort, is associated with the control. This allows you to create multiple controls on a Web page and programmatically determine which control is clicked.

  The event is raised through the control hierarchy in the form of the BubbleEvent.

  Raising an event invokes the event handler through a delegate. For more information, see [<topic://cpconProvidingEventFunctionality>].

  The method also allows derived classes to handle the event without attaching a delegate. This is the preferred technique for handling the event in a derived class.

  Raises the event of the control.

  A that contains the event data. 1.0.5000.0 2.0.0.0
- Method
  System.Void ``

  The method notifies the control to perform any necessary prerendering steps prior to saving view state and rendering content to the client.

  Raises the event.

  An object that contains the event data. 1.0.5000.0 2.0.0.0
- Property
  2.0.0.0
  System.ComponentModel.DefaultValue("")
  System.Web.UI.UrlProperty("*.aspx")
  System.Web.UI.Themeable(false)
  System.ComponentModel.Editor("System.Web.UI.Design.UrlEditor, System.Design, Version=2.0.0.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a", "System.Drawing.Design.UITypeEditor, System.Drawing, Version=2.0.0.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a")
  System.String To be added.

  The property allows you to perform a cross-page post using the control. Set the property to the URL of the Web page to post to when the control is clicked. For example, specifying Page2.aspx causes the page that contains the control to post to Page2.aspx. If you do not specify a value for the property, the page posts back to itself.

  When performing a cross-page postback with controls with server-side validation, you should check that the page's property is true before processing the postback. In the case of a cross-page postback, the page to check is the PreviousPage. The following Visual Basic code shows how this is done:

  `Sub Page_Load(ByVal sender As Object, ByVal e As System.EventArgs) Handles Me.Load If Page.PreviousPage.IsValid Then ' Handle the post back Else Response.Write("Invalid") End If End Sub`

  For more information on cross-page posting techniques, see Cross-Page Posting in an ASP.NET Web Page.

  This property cannot be set by themes or style sheet themes. For more information, see and ASP.NET Themes Overview.

  Gets or sets the URL of the page to post to from the current page when the control is clicked.

- Method
  2.0.0.0
  System.Void ``

  This event is used internally by the control, when it is clicked, to raise a event, and if defined, a event.

  Raises events for the control when it posts back to the server.

  The argument for the event.
- Method
  System.Void ``

  This method is used primarily by control developers.

  Renders the contents of the control to the specified writer.

  A that represents the output stream to render HTML content on the client. 1.0.5000.0 2.0.0.0
- Method
  1.0.5000.0
  2.0.0.0
  System.Void `` To be added.

  This member is an explicit interface member implementation. It can be used only when the instance is cast to an interface.

  For a description of this member, see .

- Property
  System.String To be added: an object of type 'string'

  Use the property to specify or determine the caption to display on the control.

  This control can be used to display user input, which might include malicious client script. Check any information that is sent from a client for executable script, SQL statements, or other code before displaying it in your application. ASP.NET provides an input request validation feature to block script and HTML in user input. Validation server controls are also provided to assess user input. For more information, see [<topic://cpconASPNETSyntaxForValidationControls>].

  The value of this property, when set, can be saved automatically to a resource file by using a designer tool. For more information, see and ASP.NET Globalization and Localization.

  Gets or sets the text caption displayed on the control.

  1.0.5000.0
  2.0.0.0
  System.ComponentModel.Localizable(true)
  System.Web.UI.PersistenceMode(System.Web.UI.PersistenceMode.InnerDefaultProperty)
  System.ComponentModel.DefaultValue("")
  System.ComponentModel.Bindable(true)
- Property
  2.0.0.0
  System.Web.UI.Themeable(false)
  System.ComponentModel.DefaultValue("")
  System.String To be added.

  Validation groups allow you to assign validation controls on a page to a specific category. Each validation group can be validated independently of other validation groups on the page. Use the property to specify the name of the validation group for which the control causes validation when it posts back to the server.

  This property has an effect only when the value of the property is set to true. When you specify a value for the property, only the validation controls that are part of the specified group are validated when the control posts back to the server. If you do not specify a value for this property and the property is set to true, all validation controls on the page that are not assigned to a validation group are validated when the control posts back to the server.

  This property cannot be set by themes or style sheet themes. For more information, see and ASP.NET Themes Overview.

  Gets or sets the group of controls for which the control causes validation when it posts back to the server.