UncleCoder.com

UncleCoder.com

Free programming examples and instructions

Asp.net javascript click event from asp button

Demo and code for how to use javascript click event from server button

by Athil


Posted on 01 Jan 0001 Category: Asp.net Views: 135

Edited on 01 Jan 0001


Here I am going to show how to use javascript click event from Asp button

DEMO

<asp:Button ID="Button1" runat="server" OnClientClick="alert('from javascript');" Text="Click Here" />

To call javascript click event from ASP button use OnClientClick event from asp button

Full Demo Code


?<%@ Page Language="C#" AutoEventWireup="true" CodeBehind="JavascriptEventonAspbutton.aspx.cs" Inherits="recaptcha.JavascriptEventonAspbutton" %>

<!DOCTYPE html>

<html xmlns="http://www.w3.org/1999/xhtml">
<head runat="server">
    <title></title>
</head>
<body>
    <form id="form1" runat="server">
    <div>
    <h1>Demo Javascript Event on ASP Button </h1>
        <asp:Button ID="Button1" runat="server" OnClientClick="alert('from javascript');" Text="Click Here" />
    </div>
    </form>

</body>
</html>

 

 



Leave a Comment:


Advertisement