Button.OnClientClick Property

 
System_CAPS_noteNote

The .NET API Reference documentation has a new home. Visit the .NET API Browser on docs.microsoft.com to see the new experience.

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

Namespace:   System.Web.UI.WebControls
Assembly:  System.Web (in System.Web.dll)

[<ThemeableAttribute(false)>]
abstract OnClientClick : string with get, set
[<ThemeableAttribute(false)>]
override OnClientClick : string with get, set

Property Value

Type: System.String

The client-side script that executes when a Button control's Click event is raised.

Use the OnClientClick property to specify additional client-side script that executes when a Button control's Click event is raised. The script that you specify for this property is rendered in the Button 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 ThemeableAttribute and ASP.NET Themes and Skins.

A Visual Studio Web site project with source code is available to accompany this topic: Download.

The following code example demonstrates how to use the OnClientClick property to specify additional client-side script that executes when a Button control is clicked.

No code example is currently available or this language may not be supported.

.NET Framework
Available since 2.0
Return to top
Show: