System.Web.UI.WebControls Namespace LinkButton Class
Occurs when a LinkButton control on a Web Forms page is clicked.
[ VB ]
Public Event Click As EventHandler
[ C# ]
public event EventHandler Click;
[ C++ ]
public: __event EventHandler* Click;
In [ JScript ], you can handle the events defined by a class, but you cannot define your own.
The method assigned to handle the event is passed an ImageClickEventArgs object containing data related to the Click event.
A Click event is raised whenever a LinkButton control on a Web Forms page is clicked. This event is commonly used when no command name is associated with the LinkButton control, typically to trigger a form submit handler.
For more information about handling events, see Web Forms Events Model.
The following example shows how to specify and code a simple handler for the Click event of a LinkButton control.
void showMessage ( Object src, EventArgs e ) {
userName.Text = ( userName.Text == "" ) ? "earthling" : userName.Text;
message.Text = "Greetings, " + userName.Text + ", welcome to ASP.NET";
}
Sub showMessage ( src As Object, e As EventArgs )
userName.Text = IIf ( userName.Text = "", "earthling", userName.Text )
message.Text = "Greetings, " + userName.Text + ", welcome to ASP.NET"
End Sub |
|
C# |
VB |
Show me
LinkButton Members Command Event