asp button on client click (C#) : Client Event « Development « ASP.Net






asp button on client click (C#)

<%@ Page Language="C#" %>
<script runat="server">

    protected void btnDelete_Click(object sender, EventArgs e)
    {
        lblResult.Text = "All pages deleted!";
    }
</script>
<html>
<head>
    <title>Button OnClientClick</title>
</head>
<body>
    <form id="form1" runat="server">
    <div>
    
    <asp:Button
        id="btnDelete"
        Text="Delete Website"
        OnClick="btnDelete_Click"
        OnClientClick="return confirm('Are you sure?');" 
        Runat="server" />
    
    <asp:Label
        id="lblResult"
        Runat="server" />    
    
    </div>
    </form>
</body>
</html>

           
       








Related examples in the same category